import { type Str } from "https://deno.land/x/rimbu@0.13.1/typical/index.ts";
const { StartsWith } = Str;
If the given string does not start with the given Start
type, returns false.
Otherwise, returns a tuple containing the matched start and the rest.
Examples
Example 1
Example 1
StartsWith<'abcd', 'ab'> => ['ab', 'cd']
StartsWith<'abcd', 'd'> => false
StartsWith<'abcd', 'ab' | 'bc'> => ['ab', 'cd']
StartsWith<'abcd', 'ab' | 'a'> => ['ab', 'cd'] | ['a', 'bcd']
Type Parameters
Start extends string & NonEmptyString<Start>