StringBuilder appendCodePoint() method in Java with Examples
The appendCodePoint(int codePoint) method of StringBuilder class is the inbuilt method used to append the string representation of the codePoint argument to this sequence.
The argument is appended to this StringBuilder content and length of the object is increased by Character.charCount(codePoint). The effect is the same as if the int value in parameter is converted to a char array and the character in that array were then appended to this character sequence.
Syntax:
public StringBuilder appendCodePoint(int codePoint)
Parameters: This method accepts only one parameter codePoint which is int type value refers to a Unicode code point.
Return Value: This method returns reference to this object.
Below programs illustrate the java.lang.StringBuilder.appendCodePoint() method:
Example 1:
// Java praogram to illustrate the // appendCodePoint(int codePoint) import java.lang.*; public class Geeks { public static void main(String[] args) { // create StringBuilder object StringBuilder str = new StringBuilder("GeeksforGeeks"); System.out.println("StringBuilder = " + str); // Append 'C'(67) to the String str.appendCodePoint(67); // Print the modified String System.out.println("Modified StringBuilder = " + str); } } |
StringBuilder = GeeksforGeeks Modified StringBuilder = GeeksforGeeksC
Example 2:
// Java praogram to illustrate the // appendCodePoint(int codePoint) import java.lang.*; public class Geeks { public static void main(String[] args) { // create StringBuilder object StringBuilder str = new StringBuilder("GeeksforGeeks"); System.out.println("StringBuilder = " + str); // Append ', '(44) to the String str.appendCodePoint(44); // Print the modified String System.out.println("Modified StringBuilder = " + str); } } |
StringBuilder = GeeksforGeeks Modified StringBuilder = GeeksforGeeks,
References: https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html#appendCodePoint(int)
Recommended Posts:
- StringBuffer appendCodePoint() Method in Java with Examples
- StringBuilder toString() method in Java with Examples
- StringBuilder trimToSize() method in Java with Examples
- StringBuilder lastIndexOf() method in Java with Examples
- StringBuilder offsetByCodePoints() method in Java with Examples
- StringBuilder substring() method in Java with examples
- StringBuilder append() Method in Java With Examples
- StringBuilder indexOf() method in Java with Examples
- Matcher appendTail(StringBuilder) method in Java with Examples
- Matcher appendReplacement(StringBuilder, String) method in Java with Examples
- StringBuilder reverse() in Java with Examples
- StringBuilder setCharAt() in Java with Examples
- StringBuilder replace() in Java with Examples
- StringBuilder deleteCharAt() in Java with Examples
- StringBuilder codePointBefore() in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Akanksha_Rai



