codetrix
Version:
A lightweight lodash-style utility library
12 lines (11 loc) • 323 B
TypeScript
/**
* Counts how many times a character appears in a string.
*
* @param str - The string to search.
* @param char - The character to count.
* @returns The number of occurrences.
*
* @example
* countOccurrence('hello world', 'l'); // 3
*/
export declare function countOccurrence(str: string, char: string): number;