diff options
| author | gingerBill <bill@gingerbill.org> | 2024-07-10 16:34:15 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-07-10 16:34:15 +0100 |
| commit | f75a45c3fa4308a139b67bb380aacc6c937cfafb (patch) | |
| tree | db617b8c62aa3c21b1d7ea5263cb74df6418c9cb /core/strings | |
| parent | 7e413405107b86741d67438aa5f0d10c0edd5942 (diff) | |
Add aliases `starts_with` and `ends_with`
Diffstat (limited to 'core/strings')
| -rw-r--r-- | core/strings/strings.odin | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin index a56aeecda..e9b50bab0 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -531,6 +531,9 @@ Output: has_prefix :: proc(s, prefix: string) -> (result: bool) { return len(s) >= len(prefix) && s[0:len(prefix)] == prefix } + +starts_with :: has_prefix + /* Determines if a string `s` ends with a given `suffix` @@ -562,6 +565,9 @@ Output: has_suffix :: proc(s, suffix: string) -> (result: bool) { 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 |