Skip to content

lib.strings

Sfall string library functions Converted from headers/sfall/lib.strings.h @author phobos2077

function string_contains(str: string, sub: string): boolean

Check if str contains sub anywhere

function string_starts_with(str: string, sub: string): boolean

Check if str starts with sub

function string_join(array: SfallList<string>, join: string): string

Join array of strings with delimiter

function string_repeat(str: string, count: number): string

Create string by repeating str count times

function string_split_ints(str: string, split: string): SfallList<number>

Split string and convert parts to integers

function string_to_int(str: string): number

atoi wrapper for use as delegate

function string_to_float(str: string): number

atof wrapper for use as delegate

function to_string(val: any): string

Convert value to string

function string_null_or_empty(str: string): boolean

Check if string is null or empty

function parse_str_2(str: string, x1: any, x2: any): string

Parse string template with %1% and %2% placeholders. Example: parse_str_2(“Hello, %2%. I have $%1%.”, 100, “World”) -> “Hello, World. I have $100.”