java命名空间java.lang类character的类成员方法:
tochars定义及介绍
本文导语:
tochars
public static int tochars(int codepoint,
char[] dst,
int dstindex)
将指定字符(unicode 代码点)转换为其 utf-8 表示形式。如果指定代码点是一个 bmp(basic multilingual plane 或 plane 0)值,则在 dst[d...
tochars
public static int tochars(int codepoint,
char[] dst,
int dstindex)
- 将指定字符(unicode 代码点)转换为其 utf-8 表示形式。如果指定代码点是一个 bmp(basic multilingual plane 或 plane 0)值,则在
dst[dstindex]
中存储相同的值,并返回 1。如果指定代码点是一个增补字符,则将其代理项值存储在 dst[dstindex]
(高代理项)和 dst[dstindex+1]
(低代理项)中,并返回 2。
- 参数:
codepoint
- 要转换的字符(unicode 代码点)。dst
- char
的一个数组,codepoint
的 utf-16 值存储在其中。dstindex
- 进入存储已转换值的 dst
数组中的起始索引。
- 返回:
- 如果代码点是一个 bmp 代码点,则返回 1,如果代码点是一个增补代码点,则返回 2。
- 抛出:
illegalargumentexception
- 如果指定的 codepoint
不是一个有效的 unicode 代码点。
nullpointerexception
- 如果指定的 dst
为 null。
indexoutofboundsexception
- 如果 dstindex
为负或不小于 dst.length
,或者 dstindex
上的 dst
没有足够多的数组元素来存储得到的 char
值。(如果 dstindex
等于 dst.length-1
并且指定的 codepoint
是一个增补字符,则不在 dst[dstindex]
中存储高代理项值。)- 从以下版本开始:
- 1.5