3.3 KiB
module utf8
Contents
- get_rune
- is_control
- is_global_punct
- is_letter
- is_number
- is_punct
- is_rune_global_punct
- is_rune_punct
- is_space
- len
- raw_index
- reverse
- to_lower
- to_upper
- validate
- validate_str
get_rune
fn get_rune(s string, index int) rune
get_rune convert a UTF-8 unicode codepoint in string[index] into a UTF-32 encoded rune
is_control
fn is_control(r rune) bool
is_control return true if the rune is control code
is_global_punct
fn is_global_punct(s string, index int) bool
is_global_punct return true if the string[index] byte of is the start of a global unicode punctuation
is_letter
fn is_letter(r rune) bool
is_letter returns true if the rune is unicode letter or in unicode category L
is_number
fn is_number(r rune) bool
is_number returns true if the rune is unicode number or in unicode category N
is_punct
fn is_punct(s string, index int) bool
is_punct return true if the string[index] byte is the start of a unicode western punctuation
is_rune_global_punct
fn is_rune_global_punct(r rune) bool
is_rune_global_punct return true if the input unicode is a global unicode punctuation
is_rune_punct
fn is_rune_punct(r rune) bool
is_rune_punct return true if the input unicode is a western unicode punctuation
is_space
fn is_space(r rune) bool
is_space returns true if the rune is character in unicode category Z with property white space or the following character set:
`\t`, `\n`, `\v`, `\f`, `\r`, ` `, 0x85 (NEL), 0xA0 (NBSP)
len
fn len(s string) int
len return the length as number of unicode chars from a string
raw_index
fn raw_index(s string, index int) string
raw_index - get the raw unicode character from the UTF-8 string by the given index value as UTF-8 string. example: utf8.raw_index('我是V Lang', 1) => '是'
reverse
fn reverse(s string) string
reverse - returns a reversed string. example: utf8.reverse('你好世界hello world') => 'dlrow olleh界世好你'.
to_lower
fn to_lower(s string) string
to_lower return an lowercase string from a string
to_upper
fn to_upper(s string) string
to_upper return an uppercase string from a string
validate
fn validate(data &u8, len int) bool
validate reports if data consists of valid UTF-8 runes
validate_str
fn validate_str(str string) bool
validate_str reports if str consists of valid UTF-8 runes