Text iterators and string views¶
No import is needed.
Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.
span¶
A view of the whole string.
span¶
A view of [start, end), clamped exactly like substring.
matches_span¶
Returns whether this value equals the supplied text view.
view_eq¶
Tests equality of the supplied text ranges.
public static extern fun view_eq(
borrow a: string,
ao: int,
an: int,
borrow b: string,
bo: int,
bn: int
): int
view_compare¶
Compares the supplied text ranges in lexical order.
public static extern fun view_compare(
borrow a: string,
ao: int,
an: int,
borrow b: string,
bo: int,
bn: int
): int
view_hash¶
Returns a hash of the specified text range.
view_find¶
Finds the first matching text range at or after from, or returns -1.
public static extern fun view_find(
borrow h: string,
ho: int,
hn: int,
borrow nd: string,
no: int,
nn: int,
from: int
): int
view_rfind¶
Finds the last matching text range, or returns -1.
public static extern fun view_rfind(
borrow h: string,
ho: int,
hn: int,
borrow nd: string,
no: int,
nn: int
): int
view_find_char¶
Finds character c at or after from, or returns -1.
public static extern fun view_find_char(
borrow s: string,
off: int,
n: int,
from: int,
c: int
): int
view_rfind_char¶
Finds the last occurrence of character c, or returns -1.
view_count_char¶
Counts occurrences of character c in the specified text range.