StrAllows storing a collection of multiple characters under a single variable.
obj Str {
empty: bool
len: int
lower: Self
lowerFirst: Self
upper: Self
upperFirst: Self
}
empty - Whether string has characters.
len - Number of characters.
lower - Representation of string with characters lowercased.
lowerFirst - Representation of string with first character lowercased.
upper - Representation of string with characters uppercased.
upperFirst - Representation of string with first character uppercased.
Str.contains()Checks whether calling string contains search substring.
fn Str.contains (search: Self) bool
search - Substring to check if exists.
Str.find()Searches for substring and returns its position, otherwise -1 is returned.
fn Str.find (search: Self) int
search - Substring to search for.
Str.lines()Splits string by lines. Delimited by any of: \r, \n, \r\n.
fn Str.lines (keepLineBreaks := false) Self[]
keepLineBreaks - Whether resulting array should contain line endings. The default is false.
Str.replace()Returns a copy of calling string with search replaced with replacement.
fn Str.replace (search: Self, replacement: Self, count := 0) Self
search - Substring to search for.
replacement - Substring to replace with.
count - Number of times search should be replaced. All occurrences are replaced when count <= 0.
Str.slice()Extracts string slice from start to end (end not included).
fn Str.slice (start := 0, end := self.len) Self
start - Index at which to start extraction. The default is zero.
end - Index at which to end extraction. The default is string length.
start then nothing is extracted.Str.split()Splits string into array of string delimited with delimiter.
fn Str.split (delimiter := "") Self[]
delimiter - Delimiter to split with.
Str.toBuffer()Converts a string to buffer_Buffer object.
fn Str.toBuffer () buffer_Buffer
Str.toFloat()Converts a string to float representation.
fn Str.toFloat () float
Str.toF32()Converts a string to f32 representation.
fn Str.toF32 () f32
Str.toF64()Converts a string to f64 representation.
fn Str.toF64 () f64
Str.toInt()Converts a string to int representation.
fn Str.toInt (radix := 10) int
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toI8()Converts a string to i8 representation.
fn Str.toI8 (radix := 10) i8
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toI16()Converts a string to i16 representation.
fn Str.toI16 (radix := 10) i16
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toI32()Converts a string to i32 representation.
fn Str.toI32 (radix := 10) i32
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toI64()Converts a string to i64 representation.
fn Str.toI64 (radix := 10) i64
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toU8()Converts a string to u8 representation.
fn Str.toU8 (radix := 10) u8
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toU16()Converts a string to u16 representation.
fn Str.toU16 (radix := 10) u16
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toU32()Converts a string to u32 representation.
fn Str.toU32 (radix := 10) u32
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.toU64()Converts a string to u64 representation.
fn Str.toU64 (radix := 10) u64
radix - Number between 2 and 36 that represents radix of the string. Use 0 to auto-guess radix.
Str.trim()Returns a string with whitespaces removed from both ends.
fn Str.trim () Self
Str.trimEnd()Returns a string with whitespaces removed from the end.
fn Str.trimEnd () Self
Str.trimStart()Returns a string with whitespaces removed from the beginning.
fn Str.trimStart () Self