Skip to content

encoding.utf8 #

fn 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

fn get_uchar #

deprecated: use `.get_rune(s string, index int)` instead
deprecated_after: 2024-11-17
fn get_uchar(s string, index int) int

get_uchar convert a UTF-8 unicode codepoint in string[index] into a UTF-32 encoded 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_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

fn is_rune_punct #

fn is_rune_punct(r rune) bool

is_rune_punct return true if the input unicode is a western unicode 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 #

deprecated: use `.is_rune_global_punct(r rune)` instead
deprecated_after: 2024-11-17
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 #

deprecated: use `.is_rune_punct(r rune)` instead
deprecated_after: 2024-11-17
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 unicode character from the UTF-8 string by the given index value as UTF-8 string. 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