Skip to content

encoding.utf8 #

fn get_uchar #

fn get_uchar(s string, index int) int

get_uchar convert a unicode glyph in string[index] into a int unicode char

fn is_control #

fn is_control(r rune) bool

is_control return true if the rune is control code

fn 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

fn is_letter #

fn is_letter(r rune) bool

is_letter returns true if the rune is unicode letter or in unicode category L

fn is_number #

fn is_number(r rune) bool

is_number returns true if the rune is unicode number or in unicode category N

fn 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

fn 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)

fn is_uchar_global_punct #

fn is_uchar_global_punct(uchar int) bool

is_uchar_global_punct return true if the input unicode is a global unicode punctuation

fn is_uchar_punct #

fn is_uchar_punct(uchar int) bool

is_uchar_punct return true if the input unicode is a western unicode punctuation

fn len #

fn len(s string) int

len return the length as number of unicode chars from a string

fn raw_index #

fn raw_index(s string, index int) string

raw_index - get the raw character from the string by the given index value. example: utf8.raw_index('我是V Lang', 1) => '是'

fn reverse #

fn reverse(s string) string

reverse - returns a reversed string. example: utf8.reverse('你好世界hello world') => 'dlrow olleh界世好你'.

fn to_lower #

fn to_lower(s string) string

to_lower return an lowercase string from a string

fn to_upper #

fn to_upper(s string) string

to_upper return an uppercase string from a string

fn validate #

fn validate(data &u8, len int) bool

validate reports if data consists of valid UTF-8 runes

fn validate_str #

fn validate_str(str string) bool

validate_str reports if str consists of valid UTF-8 runes