String module

split_from_left_by_any

procedure · 1 overloadSource

Splits s at the first byte that is in bytes. Returns whether one was found, the part before it and the part after it. When none is found the result is false, all of s and an empty string.

split_from_left_by_any :: (
    s: string,
    bytes: string
) -> (found: bool, left: string, right: string)

Parameters

s: string
bytes: string

Returns

found: bool
left: string
right: string
ExampleOpen in playground ↗
found, left, right := split_from_left_by_any("a,b;c", ",;");
assert(found && left == "a" && right == "b;c");

See also