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."
String#encode (Ruby 3.3 リファレンスマニュアル)
https://docs.ruby-lang.org/ja/latest/method/String/i/encode.html
> encode(encoding, **options) -> String
String#length (Ruby 3.3 リファレンスマニュアル)
https://docs.ruby-lang.org/ja/latest/method/String/i/length.html
> 文字列の文字数を返します。
おいおいおい何もわかんねえぞ
神宮外苑再開発 “人権に悪影響の可能性”国連の作業部会 公表 | NHK | 国連 https://www3.nhk.or.jp/news/html/20240530/k10014465761000.html
05月26日
静岡県知事選 出口調査の結果|NHK 静岡県のニュース https://www3.nhk.or.jp/lnews/shizuoka/20240526/3030023983.html