utf8

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


ข้อมูลสรุป

คุณสมบัติ

เอกสารอ้างอิงเกี่ยวกับ API
ฟังก์ชัน
char
utf8.char(codepoints:Tuple<number>):string
พารามิเตอร์
codepoints:Tuple<number>
ส่งค่ากลับ
ตัวอย่างโค้ด
อักขระ Utf8

codes
utf8.codes(str:string):function,string,number
พารามิเตอร์
str:string
ส่งค่ากลับ
ตัวอย่างโค้ด
รหัส Utf8

codepoint
utf8.codepoint(
str:string, i:number, j:number
พารามิเตอร์
str:string
ค่าเริ่มต้น: 1
ค่าเริ่มต้น: i
ส่งค่ากลับ
ตัวอย่างโค้ด
รหัส Utf8

len
utf8.len(
พารามิเตอร์
ค่าเริ่มต้น: 1
ค่าเริ่มต้น: -1
ส่งค่ากลับ
ตัวอย่างโค้ด
ความยาว Utf8

offset
utf8.offset(
พารามิเตอร์
ค่าเริ่มต้น: 1
ส่งค่ากลับ
ตัวอย่างโค้ด
ออฟเซ็ต Utf8

graphemes
utf8.graphemes(
str:string, i:number, j:number
พารามิเตอร์
str:string
ส่งค่ากลับ
ตัวอย่างโค้ด
อักขระ Utf8
-- "e" ตามด้วยเครื่องหมายวรรณยุกต์รวมเป็นอักขระเดียวแต่มีรหัสจุดสองรหัส
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 1

nfcnormalize
utf8.nfcnormalize(str:string):string
พารามิเตอร์
str:string
ส่งค่ากลับ
ตัวอย่างโค้ด
การทำให้เป็นมาตรฐาน Utf8 NFC
local decomposed = "e\u{0301}" -- "e" บวกกับเครื่องหมายวรรณยุกต์ที่รวม
local composed = utf8.nfcnormalize(decomposed)
print(utf8.len(decomposed)) --> 2
print(utf8.len(composed)) --> 1
print(composed == "\u{00E9}") --> true

nfdnormalize
utf8.nfdnormalize(str:string):string
พารามิเตอร์
str:string
ส่งค่ากลับ
ตัวอย่างโค้ด
การทำให้เป็นมาตรฐาน Utf8 NFD
local composed = "\u{00E9}" -- precomposed "é"
local decomposed = utf8.nfdnormalize(composed)
print(utf8.len(composed)) --> 1
print(utf8.len(decomposed)) --> 2
print(decomposed == "e\u{0301}") --> true

คุณสมบัติ
charpattern
utf8.charpattern:string
ตัวอย่างโค้ด
รูปแบบอักขระ Utf8

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ