Upgrade to Pro — share decks privately, control downloads, hide ads and more …

文字数はおいくら?(Ruby版)

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

 文字数はおいくら?(Ruby版)

サロゲート文字とか合字とか異体字とかの文字数を取得してみました。

Avatar for tsuda.a

tsuda.a

April 05, 2014

More Decks by tsuda.a

Other Decks in Programming

Transcript

  1. 4.C#だとこんな感じ Ruby C# サロゲート 𩹉 (U+29E49) 1 2 合字 を

    ゙ (U+3092 U+3099) 2 2 が (U+304B U+3099) 2 2 が (U+304C) 1 1 異体字 辻 (U+8FBB) 1 1 辻󠄀 (U+8FBB U+E0100) 2 3 内部がUTF-16なので、 サロゲート領域(U+10000以上) の文字は 2 でカウントされる。