1
0
mirror of https://github.com/janet-lang/janet synced 2025-05-02 15:34:15 +00:00

Update src/core/string.c

Co-authored-by: John W Higgins <wishdev@gmail.com>
This commit is contained in:
Calvin Rose 2024-05-18 19:59:43 -05:00 committed by GitHub
parent 6e82123fdb
commit 421f7a2906
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -582,9 +582,9 @@ static size_t trim_help_leftedge(JanetByteView str, JanetByteView set) {
}
static size_t trim_help_rightedge(JanetByteView str, JanetByteView set) {
for (size_t i = str.len - 1; i > 0; i--)
if (!trim_help_checkset(set, str.bytes[i]))
return i + 1;
for (size_t i = 0; i < str.len; i++)
if (!trim_help_checkset(set, str.bytes[str.len - i - 1]))
return str.len - i;
return 0;
}