Skip to content

Commit abe1a30

Browse files
authored
update string.c.ri
1 parent 7974266 commit abe1a30

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/core/src/string.c.ri

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,8 @@ public struct string < Stringable, Hashable, Throwable {
281281

282282
/// Linear search for the last index of `byte` inside a string.
283283
public func last_index_of_byte(self, byte: uint8) -> ?uint {
284-
mut i: uint := self.len;
285-
while i != 0 {
286-
i -= 1;
284+
mut i: uint := self.len - 1;
285+
while i >= 0 : i -= 1 {
287286
if unsafe { self.ptr[i] == byte } {
288287
return i;
289288
}

0 commit comments

Comments
 (0)