String module

contains_any_string

procedure · 1 overloadSource

Whether any of the substrings appears in s, and the part of s after the earliest match. At one position the first substring listed wins. Empty substrings are ignored.

contains_any_string :: (
    s: string,
    substrings: ..string
) -> (found: bool, remainder: string)

Parameters

s: string
substrings: ..string

Returns

found: bool
remainder: string
ExampleOpen in playground ↗
found, rest := contains_any_string("say hello world", "world", "hello");
assert(found && rest == " world");

See also