Skip to main content
Module

x/rimbu/typical/mod.ts>Str.TakeWhile

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias Str.TakeWhile
import { type Str } from "https://deno.land/x/rimbu@0.12.3/typical/mod.ts";
const { TakeWhile } = Str;

Returns part of the string as long as its parts match Sub.

Examples

Example 1

TakeWhile<'aabc', 'a'> => 'aa'
TakeWhile<'aabc', 'a' | 'b'> => 'aab'
TakeWhile<'aabc', 'q'> => ''

Type Parameters

S extends string
Sub extends string & NonEmptyString<Sub>
definition: TakeWhileHelper<S, Sub, "">