Skip to content

wordCount ​

Подсчитывает количество слов в строке.

wordCount ​

Сигнатура ​

typescript
function wordCount(str: string): number

Примеры ​

typescript
import { wordCount } from 'strio'

wordCount('hello world')
// 2

wordCount('The quick brown fox')
// 4

Связанные функции ​

  • words - Разделить на слова
  • count - Подсчет вхождений

Смотрите также ​

Выпущено под лицензией MIT.