From 031b0cc53493249be6cb421c65d089e1ce0a06f2 Mon Sep 17 00:00:00 2001 From: Walther Chen Date: Tue, 5 Dec 2023 16:09:09 -0500 Subject: fix strings.last_index_any for single char --- core/strings/strings.odin | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/strings') 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 { -- cgit v1.2.3