Java StringBuilder appendCodePoint()方法
java.lang.StringBuilder.appendCodePoint(int codePoint) 方法追加码点codePoint 参数到此序列的字符串表示形式。该参数被附加到这个序列中的内容。
1 语法
public StringBuilder appendCodePoint(int codePoint)
2 参数
codePoint : 这是Unicode代码点。
3 返回值
该方法返回这个对象的引用。
4 示例
package com.yiidian;
/**
* 一点教程网: http://www.yiidian.com
*/
/**
* Java StringBuilder appendCodePoint()方法
*/
import java.lang.*;
public class StringBuilderDemo {
public static void main(String[] args) {
StringBuilder str = new StringBuilder("programming");
System.out.println("string = " + str);
// appends the CodePoint as string to the StringBuilder
str.appendCodePoint(74);
// print the StringBuilder after appendingCodePoint 74
System.out.println("After appendCodePoint = " + str);
}
}
输出结果为:
string = programming
After appendCodePoint = programmingJ
热门文章
优秀文章