Quirrel4.41.0

string

Methods on every string.

Functions

cloneclone(): anyReturns str itself.
concatpure string.concat(value, ...): anyJoins its arguments into one string, with str between each pair.
constructorconstructor(value): anyConverts value to a string. This is what runs when types.String itself is called, types.String(value), the same way types.Integer(value) converts to an integer.
containspure string.contains(substr: string, [start: number], ...): anyReturns whether str contains substr.
endswithstring.endswith(suffix: string): anyReturns whether str ends with suffix.
escapestring.escape(): anyReturns str with backslash, the two quote characters, and every non-printable-ASCII byte replaced by an escape sequence.
hashpure string.hash(): anyReturns str's hash.
hasindexpure string.hasindex(index: number, ...): anyReturns whether index is a valid byte position in str.
indexofpure string.indexof(substr: string, [start: number], ...): anyReturns the byte index of the first occurrence of substr in str.
joinpure string.join(arr: array, [filter: bool|function], ...): anyJoins the items of arr into one string, with str between each pair.
lenpure string.len(): anyReturns the length of str in bytes.
lstripstring.lstrip(): anyReturns str with white space removed from the beginning only.
replacepure string.replace(from: string, to: string): anyReturns str with every occurrence of from replaced by to.
rstripstring.rstrip(): anyReturns str with white space removed from the end only.
slicepure string.slice([start: number, end: number], ...): anyReturns the bytes of str from start up to, but not including, end.
splitpure string.split([separator: string], ...): anySplits str into an array of strings.
split_by_charsstring.split_by_chars(separators: string, [skip_empty: bool], ...): anySplits str into an array of strings at every byte that occurs in separators.
startswithstring.startswith(prefix: string): anyReturns whether str begins with prefix.
stripstring.strip(): anyReturns str with white space removed from both ends.
substpure string.subst(value, ...): anySubstitutes {0}, {1}, ... and {name} placeholders in str with the given values.
tofloatpure string.tofloat(): anyParses str as a float.
tointegerpure string.tointeger([base: number], ...): anyParses str as an integer.
tolowerpure string.tolower([start: number, end: number], ...): anyReturns a copy of str with the ASCII letters in [start, end) lowercased.
tostringpure tostring(): anyReturns str itself.
toupperpure string.toupper([start: number, end: number], ...): anyReturns a copy of str with the ASCII letters in [start, end) uppercased.
weakrefweakref(): anyReturns a weak reference to str.