XU XUv0.16.0

#unicode/utf16

import: #unicode/utf16

counts: 5 functions, 0 methods, 1 types, 0 constants, 0 method sets

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 rune data.

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

Structure encapsulating r1, r2.

Public fields

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

encode_rune

XuAPI
pub fn encode_rune(r int) Pair

Purpose

Encode rune data.

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 data into output format. Throws on failure; handle the error or propagate it to the caller.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

[]int — slice result

decode

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

Purpose

Decode data from encoded representation. Throws on failure; handle the error or propagate it to the caller.

Parameters

u &[]int
u (read-only borrow; caller keeps the original; type &[]int)

Returns

string — result string