string_split_by_last :: fn (str: string, delimiter: u8, lhs: *string, rhs: *string, di: *s32 = null) bool


Split input string str into two tokens based on the last occurrence of delimiter. Delimiter is not included in resulting tokens. Result tokens only points into original memory of the str, they are not supposed to be freed.

When delimiter is not present in the input string function return false, lhs and rhs buffers are not modified, otherwise function return true and sets lhs and rhs to found values.


  • str String to be splitted.

  • delimiter Delimiter to be found.

  • lhs Optional output left hand side string.

  • rhs Optional output right hand side string.

  • di Optional output split destination index.


True when delimiter was found.


main :: fn () s32 {
    lhs: string;
    rhs: string;
    if string_split_by_last("this/is/my/epic/path", '/', &lhs, &rhs) {
        print("lhs = %\n", lhs);
        print("rhs = %\n", rhs);

    return 0;

Declared in: