Browse Source

Add aliases `starts_with` and `ends_with`

gingerBill 1 year ago
parent
commit
f75a45c3fa
1 changed files with 6 additions and 0 deletions
  1. 6 0
      core/strings/strings.odin

+ 6 - 0
core/strings/strings.odin

@@ -531,6 +531,9 @@ Output:
 has_prefix :: proc(s, prefix: string) -> (result: bool) {
 has_prefix :: proc(s, prefix: string) -> (result: bool) {
 	return len(s) >= len(prefix) && s[0:len(prefix)] == prefix
 	return len(s) >= len(prefix) && s[0:len(prefix)] == prefix
 }
 }
+
+starts_with :: has_prefix
+
 /*
 /*
 Determines if a string `s` ends with a given `suffix`
 Determines if a string `s` ends with a given `suffix`
 
 
@@ -562,6 +565,9 @@ Output:
 has_suffix :: proc(s, suffix: string) -> (result: bool) {
 has_suffix :: proc(s, suffix: string) -> (result: bool) {
 	return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
 	return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
 }
 }
+
+ends_with :: has_suffix
+
 /*
 /*
 Joins a slice of strings `a` with a `sep` string
 Joins a slice of strings `a` with a `sep` string