|
|
|
|
|
by signal11
1675 days ago
|
|
Swift handles this really well, "त्या".count // 1 "त्या".unicodeScalars.count // 4 "त्या".utf8.count // 12 Javascript's minimal library is of course not great, but there are libraries which can help, e.g. grapheme-splitter, although it's not language-aware by design, so in this instance it'll return 2. graphemeSplitter.countGraphemes("त्या") // 2 |
|