String.split_at_index

split_at_index :: fn (str: string, index: s32, lhs: *string, rhs: *string) bool

Split input string str at index position and return true when split was done. Result tokens only points into original memory of the str, they are not supposed to be freed. When index is out of str range function return false, lhs and rhs buffers are not modified.

Token destination pointers lhs and rhs are optional.

Warning

lhs and rhs sub strings are not guaranteed to be zero terminated and they are not supposed to be freed.

Example

main :: fn () s32 {
    lhs: string;
    rhs: string;
    if String.split_at_index("foobar", 3, &lhs, &rhs) {
        print("lhs = %\n", lhs);
        print("rhs = %\n", rhs);
    }

    return 0;
}

Declared in: string.bl