XU XUv0.8.8
中文

API

#unicode/utf8

import: #unicode/utf8

counts: 11 fns, 0 methods, 0 types, 0 consts, 0 ifaces

UTF-8 encode/decode and validation.

rune_start

XuAPI
pub fn rune_start(b int) bool

Purpose

Rune start.

Parameters

b int
b (int)

Returns

bool — true or false

rune_len

XuAPI
pub fn rune_len(r int) int

Purpose

Rune len. Throws on failure.

Parameters

r int
rune (Unicode code point) (int)

Returns

int — a value of this type

decode

XuAPI
pub fn decode(s &string, i int) int

Purpose

Decode. Throws on failure.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)
i int
index or integer (int)

Returns

int — a value of this type

decode_width

XuAPI
pub fn decode_width(s &string, i int) int

Purpose

Decode.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)
i int
index or integer (int)

Returns

int — a value of this type

valid

XuAPI
pub fn valid(s &string) bool

Purpose

Whether the value is valid.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

bool — true or false

rune_count

XuAPI
pub fn rune_count(s &string) int

Purpose

Rune count.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

encode

XuAPI
pub fn encode(r int) string

Purpose

Encode.

Parameters

r int
rune (Unicode code point) (int)

Returns

string — result string

valid_rune

XuAPI
pub fn valid_rune(r int) bool

Purpose

Valid rune.

Parameters

r int
rune (Unicode code point) (int)

Returns

bool — true or false

full_rune

XuAPI
pub fn full_rune(s &string) bool

Purpose

Full rune.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

bool — true or false

decode_last

XuAPI
pub fn decode_last(s &string) int

Purpose

Decode. Throws on failure.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

int — a value of this type

append_rune

XuAPI
pub fn append_rune(s &string, r int) string

Purpose

Append rune.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)
r int
rune (Unicode code point) (int)

Returns

string — result string