utf8
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
APIリファレンス
関数
codes
codepoint
len
offset
graphemes
戻り値
コードサンプル
Utf8 グラフェム
-- "e" の後に結合アクセントが付いたものは1つのグラフェムですが、2つのコードポイントです
local str = "ae\u{0301}b"
print(utf8.len(str)) --> 4
for first, last in utf8.graphemes(str) do
local grapheme = string.sub(str, first, last)
print(first, last, #grapheme)
end
--> 1 1 1
--> 2 4 3
--> 5 5 1nfcnormalize
プロパティ