Function countCharsFromStart

Counts the number of times one of chars appears at the front of a string, contiguously.

countCharsFromStart(`  hi`, ` `); // 2
countCharsFromStart(`hi `, ` `); // 0
countCharsFromStart(` hi `, ` `); // 2
  • Parameters

    • source: string
    • Rest...chars: readonly string[]

    Returns number