Java Character codePointBefore() 方法2024年11月6日 | 阅读 6 分钟 此方法有 3 种语法。 Java codePointBefore(char[] a, int index) 方法Character 类的 codePointBefore(char[] a, int index) 方法返回 char 数组中给定索引的代码点。如果 char 数组中(index-1)处的 char 值处于低代理范围,则 index-2 不为负数。如果 char 数组中(index-2)处的 char 值处于高代理范围,则返回此代理对的补充代码点。否则,返回(index-1)处的 char 值。 语法参数上述方法需要两个参数
返回值codePointBefore(char[] a, int index) 方法返回给定索引之前的 Unicode 点。 示例 1输出 Welcome to java tutorials. The unicode point is given as = 87 示例 2输出 Welcome to java tutorials. Unicode code point before the string is 87 The numbers are: '1', '2', '3', '4', '5' Unicode code point before the number is 108 示例 3输出 Enter the desired index: 3 Result is given by:39 Java Character codePointBefore(char[] a, int index, int start) 方法Character 类的 codePointBefore(char[] a, int index, int start) 方法用于返回 char 数组中给定索引之前的代码点,其中只有索引大于或等于 start 的数组元素才能被使用。如果在 char 数组中,(index-1)处的 char 值处于低代理范围,则(index-2)不小于 start。另一方面,如果(index-2)处的 char 值处于高代理范围,则返回与代理对相对应的补充代码点。否则,它返回(index-1)处的 char 值。 语法参数上述方法需要三个参数
返回值codePointBefore(Char[] a, int index, int start) 方法返回索引之前的 Unicode 代码点。 示例 4输出 Welcome to our tutorial site. The unicode code point is 67 示例 5输出 Welcome to our tutorial site. The unicode code point for alphabets: The unicode code point is 67 The unicode code point for numbers: The unicode code point is 51 示例 6输出 The numbers are: '1', '2', '3', '4' The unicode code point is 51 The numbers are: '5', '6', '7', '8' The unicode code point is 55 Java Character codePointBefore(charSequence seq, int index) 方法Character 类的 codePointBefore(charSequence seq, int index) 方法用于返回 charSequence 中给定索引之前的代码点。如果在 char 序列中,(index-1)处的 char 值处于低代理范围,则(index-2)不为负数。另一方面,如果(index-2)处的 char 值处于高代理范围,则返回与此代理对相对应的补充代码点。否则,返回(index-1)处的 char 值。 语法参数上述方法需要两个参数
返回值codePointBefore(charaSequence seq, int index) 方法返回给定索引之前的 Unicode 代码点值。 示例 7输出 Welcome to our tutorial site: The Unicode code point for Java is 108 The Unicode code point for Everyone is 101 示例 8输出 The string is: Java The Unicode code point for Java is 108 The numbers are: '1', '2', '3', '4' The unicode code point for numbers is 108 示例 9输出 The numbers are: '1', '2', '3', '4': The unicode code point for first four numbers is 51 The numbers are: '1', '2', '3', '4': The unicode code point for second four numbers is 55 |
我们请求您订阅我们的新闻通讯以获取最新更新。