java.lang.StringBuffer.offsetByCodePoints()%uA0方法返回该序列中从给定的索引的codePointOffset代码点偏移的索引。
声明
以下是java.lang.StringBuffer.offsetByCodePoints()方法的声明
public int offsetByCodePoints(int index, int codePointOffset)
参数
-
index%uA0-- 这是索引偏移量。
-
codePointOffset%uA0-- 这是偏移量的代码点。
返回值
此方法返回该序列中的索引。
异常
-
NA
例子
下面的例子显示java.lang.StringBuffer.offsetByCodePoints()方法的使用。
package com.yiibai import java.lang.* public class StringBufferDemo { public static void main(String[] args) { StringBuffer buff = new StringBuffer("aawxyzaa") System.out.println("buffer = " + buff) // returns the index within this sequence int retval = buff.offsetByCodePoints(1, 4) // prints the index System.out.println("index = " + retval) } }
让我们来编译和运行上面的程序,这将产生以下结果:
buffer = aawxyzaa index = 5