diff options
| author | Walther Chen <walther.chen@gmail.com> | 2023-12-05 16:09:09 -0500 |
|---|---|---|
| committer | Walther Chen <walther.chen@gmail.com> | 2023-12-18 11:55:45 -0500 |
| commit | 031b0cc53493249be6cb421c65d089e1ce0a06f2 (patch) | |
| tree | 570d07b6c91e4a64a083ea330c3264ea536d7df6 /core/strings | |
| parent | 31b1aef44e1b0178f10f5faa62ceedddda56667b (diff) | |
fix strings.last_index_any for single char
Diffstat (limited to 'core/strings')
| -rw-r--r-- | core/strings/strings.odin | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 539829a1a..5cee25a66 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -1792,7 +1792,8 @@ last_index_any :: proc(s, chars: string) -> (res: int) { if r >= utf8.RUNE_SELF { r = utf8.RUNE_ERROR } - return index_rune(chars, r) + i := index_rune(chars, r) + return i if i < 0 else 0 } if len(s) > 8 { |