Byte_Search module

find_last

procedureextension3 overloadsSource

The last byte before end (-1: the end of the text), or -1.

Example↗
Byte_Search :: #import "Extensions/Byte_Search";

assert(Byte_Search.find_last("a/b/c", #char "/") == 3);
assert(Byte_Search.find_last("a/b/c", #char "/", 3) == 1);
find_last :: (text: string, byte: u8, end := -1) -> int

Parameters

text: string
byte: u8
end := -1

Returns

int
find_last :: (text: string, needle: string, end := -1) -> int

The last needle ending at or before end (-1: the end of the text), or -1.

Parameters

text: string
needle: string
end := -1

Returns

int
Example↗
Byte_Search :: #import "Extensions/Byte_Search";

assert(Byte_Search.find_last("one two one", "one") == 8);
find_last :: (finder: *Finder, text: string, end := -1) -> int

The last match ending at or before end (-1: the end of the text), or -1.

Parameters

finder: *Finder
text: string
end := -1

Returns

int

See also