str stats
for strings
Gather word count statistics on the text.
Signature
> str stats {flags}
Input/output types:
input | output |
---|---|
string | record |
Examples
Count the number of words in a string
> "There are seven words in this sentence" | str stats
╭───────────────┬────╮
│ lines │ 1 │
│ words │ 7 │
│ bytes │ 38 │
│ chars │ 38 │
│ graphemes │ 38 │
│ unicode-width │ 38 │
╰───────────────┴────╯
Counts unicode characters
> '今天天气真好' | str stats
╭───────────────┬────╮
│ lines │ 1 │
│ words │ 6 │
│ bytes │ 18 │
│ chars │ 6 │
│ graphemes │ 6 │
│ unicode-width │ 12 │
╰───────────────┴────╯
Counts Unicode characters correctly in a string
> "Amélie Amelie" | str stats
╭───────────────┬────╮
│ lines │ 1 │
│ words │ 2 │
│ bytes │ 15 │
│ chars │ 14 │
│ graphemes │ 13 │
│ unicode-width │ 13 │
╰───────────────┴────╯