Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

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

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

Returns the amount of times the given Sub type is encountered in the given string.

Examples

Example 1

Count<'abcba', 'c'> => 1
Count<'abcba', 'a' | 'c'> => 3
Count<'abcba', 'q'> => 0

Type Parameters

S extends string
Sub extends string & NonEmptyString<Sub>
definition: CountHelper<S, Sub, 0>