Java StringBuffer appendCodePoint()方法

java.lang.StringBuffer.appendCodePoint(int codePoint) 方法追加码点参数顺序的字符串表示形式。该参数被附加到这个序列中的内容。

1 语法

public StringBuffer appendCodePoint(int codePoint)

2 参数

codePoint : 这是一个Unicode代码点。

3 返回值

该方法返回一个此对象引用。

4 示例 

package com.yiidian;

/**
 * 一点教程网: http://www.yiidian.com
 */
/**
 * Java StringBuffer appendCodePoint()方法
 */
import java.lang.*;

public class StringBufferDemo {

  public static void main(String[] args) {
  
    StringBuffer buff = new StringBuffer("tutorials");
    System.out.println("buffer = " + buff);

    // appends the CodePoint as string to the string buffer
    buff.appendCodePoint(80);
    // print the string buffer after appendingCodePoint 80
    System.out.println("After appendCodePoint = " + buff);
  }
}

输出结果为:

buffer = tutorials
After appendCodePoint = tutorialsP

 

热门文章

优秀文章