XU XUv0.8.8
中文

API

#unicode/utf16

import: #unicode/utf16

counts: 5 fns, 0 methods, 1 types, 0 consts, 0 ifaces

UTF-16 surrogates and encode/decode.

is_surrogate

XuAPI
pub fn is_surrogate(r int) bool

Purpose

Whether it is surrogate.

Parameters

r int
rune (Unicode code point) (int)

Returns

bool — true or false

decode_rune

XuAPI
pub fn decode_rune(r1 int, r2 int) int

Purpose

Decode.

Parameters

r1 int
r1 (int)
r2 int
r2 (int)

Returns

int — a value of this type

struct Pair

XuAPI
pub struct Pair {
    pub r1 int
    pub r2 int
}

Purpose

Public struct `Pair`.

Parameters

r1 int
field (int)
r2 int
field (int)

encode_rune

XuAPI
pub fn encode_rune(r int) Pair

Purpose

Encode.

Parameters

r int
rune (Unicode code point) (int)

Returns

Pair — a value of this type

encode

XuAPI
pub fn encode(s &string) []int

Purpose

Encode. Throws on failure.

Parameters

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

Returns

[]int — slice result

decode

XuAPI
pub fn decode(u &[]int) string

Purpose

Decode. Throws on failure.

Parameters

u &[]int
u (borrowed; caller keeps it; type &[]int)

Returns

string — result string