LoginSignup
5
3

More than 3 years have passed since last update.

𠮷野家は何文字ですか?👍🏽は?

Last updated at Posted at 2019-06-13

新たな刺客👍🏽 (U+1F44D + U+1F3FD)

https://github.com/sallar/stringz
𠮷野家は四天王のうちで最弱だったのかもしれない。

各言語の結果

JavaScript

"𠮷野家".length -> 4
[..."𠮷野家"].length -> 3

"👍🏽".length -> 4
[..."👍🏽"].length -> 2

Go

len(“𠮷野家“) -> 10
len([]rune(“𠮷野家“)) -> 3

Python2

len("𠮷野家") -> 10

Python3

len("𠮷野家") -> 3
len("𠮷野家".encode()) -> 10

Ruby

"𠮷野家".size -> 3
"𠮷野家".bytesize -> 10

PHP

strlen("𠮷野家") -> 10
iconv_strlen("𠮷野家") -> 3
mb_strlen("𠮷野家") -> 3

Java

"𠮷野家".length() -> 4
"吉野家".codePointCount(0, "吉野家".length()) -> 3

C#

"𠮷野家".Length -> 4
new StringInfo("𠮷野家").LengthInTextElements -> 3

C

strlen("𠮷野家") -> 10
wcslen(L"𠮷野家") -> 3 または 4 ※
※ ワイド文字が何かによって異なる。LinuxなどUTF-32の場合は3、WindowsなどUTF-16の場合は4。

簡単な解説

バイト長 -> 10
UTF16表現での長さ -> 4
コードポイントでの長さ -> 3

他の言語の結果

編集リクエスト募集中です

おまけ

昔app engineで作ったサイトが出てきました。
https://unicodechar.appspot.com

「㍾㍼㋿」とかを互換分解(NFKD)してニヤニヤしてください。

5
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3