import { type Str } from "https://deno.land/x/rimbu@0.13.1/typical/index.ts";
const { RepeatAtMostTimes } = Str;
Returns a tuple containing the matched part and the rest of the given string if the string start repeats the given Sub at most N times.
Examples
Example 1
Example 1
RepeatAtMostTimes<'aabc', 'a', 0> => false
RepeatAtMostTimes<'aabc', 'a', 1> => false
RepeatAtMostTimes<'aabc', 'a', 3> => ['aa', 'bc']
RepeatAtMostTimes<'aabc', 'a' | 'b', 3> => ['aab', 'c']