Expand description
Lean’s String: UTF-8 text, addressed by byte position.
Positions are Nat byte offsets. A position is valid when it is at most the length in
bytes and falls on a character boundary; the functions without fast in their name accept
any position and behave as Lean’s definitions say for invalid ones. As in lean.h,
arguments are borrowed unless noted and results are owned.
Functions§
- from_
string - A new string object that takes over the buffer of
text. - into_
string ⚠ - The text of a string object, giving up one reference to it. Takes the buffer without copying when nothing else refers to the object.
- mk_
string - A new string object.
- string_
append ⚠ - Consumes
s1. - string_
compare ⚠ - An
Ordering: 0 for less, 1 for equal, 2 for greater. - string_
data ⚠ - The characters as a
List Char. Consumess. - string_
dec_ ⚠eq - string_
dec_ ⚠lt - string_
get_ ⚠byte_ fast - string_
hash ⚠ - string_
length ⚠ - The number of characters.
- string_
memcmp ⚠ - Whether
lenbytes of the two strings, from the given byte offsets, are equal. - string_
mk ⚠ - A string from a
List Char, which it consumes. - string_
of_ usize - string_
push ⚠ - Consumes
s. - string_
pushn ⚠ - Appends
ncopies of a character. Consumess. - string_
uget_ ⚠byte_ fast - string_
utf8_ ⚠at_ end - string_
utf8_ ⚠byte_ size - string_
utf8_ ⚠extract - The text from
begintoend. Empty unlessbeginis a valid position beforeend; runs to the end of the string unlessendis a valid position. - string_
utf8_ ⚠extract_ fast - The text between two valid positions.
- string_
utf8_ ⚠get - string_
utf8_ ⚠get_ fast - For a valid position that is not the end.
- string_
utf8_ ⚠next - The position after the character at
i; one byte further if there is no character. - string_
utf8_ ⚠next_ fast - string_
utf8_ ⚠prev - The position of the character before
i. - string_
utf8_ ⚠set - Replaces the character at
i. Consumess. - text⚠
- The text of a string object.