ちょっと古いけどいろんな言語環境の書記素クラスタカウントの例の記事見つけた><
2015-03-19
文字数をカウントする7つの方法
https://engineering.linecorp.com/ja/blog/the-7-ways-of-counting-characters
Swiftはちゃんと最初から文字数を返してくれるっぽい・・・?><(paiza ioで試したら実際そうなった><)
この記事の筆者はそれを嫌がってるけど><;
【pͪoͣnͬpͣoͥnͭpͣa͡inͥもあるよ】Swiftの文字数カウントがKotlinとRubyに対して差が出た話
https://zenn.dev/stadium/articles/swift-string-count
参考にした文献><
Go で文字数をカウントする - emahiro/b.log
https://ema-hiro.hatenablog.com/entry/2021/01/19/141854
s="pͪoͣnͬpͣoͥnͭpͣa͡inͥ"
s.encode("UTF-8").grapheme_clusters.size;
→10
参考文献><;
Ruby で文字数を数える #Ruby - Qiita
https://qiita.com/Nabetani/items/93e9af28bd9a2bea03f0
C# の場合どうなんだろうと思って調べてみたら、text elementsって表現してた><
StringInfo.LengthInTextElements Property (System.Globalization) | Microsoft Learn https://learn.microsoft.com/en-us/dotnet/api/system.globalization.stringinfo.lengthintextelements?view=net-8.0#system-globalization-stringinfo-lengthintextelements
"The number of base characters, surrogate pairs, and combining character sequences in this StringInfo object."