Import with #import "std/text_tools".
TextFind :: (text: string, needle: string, from: s64) -> s64The first index of NEEDLE in TEXT at or after FROM, or -1.
TextFindLast :: (text: string, needle: string) -> s64The last index of NEEDLE in TEXT, or -1.
TextContains :: (text: string, needle: string) -> boolTextHasPrefix :: (text: string, prefix: string) -> boolTextHasSuffix :: (text: string, suffix: string) -> boolTextIsSpace :: (byte: u8) -> boolTextTrim :: (text: string) -> stringTEXT without leading and trailing ASCII whitespace.
TextTrimEnd :: (text: string) -> stringTEXT without trailing ASCII whitespace.
TextSplit :: (text: string, separator: string) -> Vec(string)Every piece of TEXT between SEPARATORs, empty pieces included, as Python's str.split(separator) gives them.
TextLines :: (text: string) -> Vec(string)The lines of TEXT without their line endings (\n, \r\n or \r); a final line ending adds no empty line.
TextReplace :: (text: string, old: string, new: string) -> TextTEXT with every OLD replaced by NEW, left to right.
TextJoin :: (parts: []string, separator: string) -> TextTextLower :: (text: string) -> TextTEXT with ASCII letters in lower case.
TextIsDecimal :: (text: string) -> boolWhether TEXT is one or more decimal digits.
TextIsLowerHex :: (text: string) -> boolWhether TEXT is one or more lowercase hexadecimal digits.
TextOnly :: (text: string, allowed: string) -> boolWhether every byte of TEXT is one of ALLOWED's bytes; empty TEXT is not.
TextInteger :: (text: string) -> (s64, bool)The whole of TEXT as a decimal integer with an optional sign.
TextHexDigit :: (byte: u8) -> s32The value of a hexadecimal digit, or -1.
TextHexDecodeInto :: (value: string, output: *Vec(u8), max_bytes: s64) -> boolDecodes VALUE's uppercase or lowercase hexadecimal bytes and appends them to OUTPUT. MAX_BYTES bounds the bytes this call appends; false leaves OUTPUT unchanged on any failure, including an odd length, an invalid digit, an exceeded limit, or an allocation failure.
TextHex :: (bytes: []u8) -> TextBYTES as lowercase hexadecimal.