CharacterCount returns the number of characters in a string Similar to utf8.RuneCountInString but for unicode characters
(str string)
| 84 | // CharacterCount returns the number of characters in a string |
| 85 | // Similar to utf8.RuneCountInString but for unicode characters |
| 86 | func CharacterCountInString(str string) int { |
| 87 | s := 0 |
| 88 | |
| 89 | for _, r := range str { |
| 90 | if !isMark(r) { |
| 91 | s++ |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | return s |
| 96 | } |