Home » Java programming language

Java StringBuffer int codePointAt(int index) method with Example

Java StringBuffer int codePointAt(int index) method: Here, we are going to learn about the int codePointAt(int index) method of StringBuffer class with its syntax and example.
Submitted by Preeti Jain, on June 29, 2019

StringBuffer Class int codePoint(int index)

  • This method is available in package java.lang.StringBuffer.codePointAt(int index).
  • This method is used to return the Unicode character value (Unicode Codepoint) at the specified index in the method.
  • Index range will start from 0 to length()-1.
  • This method does not raise an exception.

Syntax:

    int codePointAt(int index){
    }

Parameter(s):

We can pass only one object in the method of the StringBuffer i.e index.

Return value:

The return type of this method is int that means this method return Unicode codepoint of the character at the given index and codepoint value is in number format.

Java program to demonstrate example of codePointAt(int index) method

import java.lang.StringBuffer;

public class StringBufferClass {
    public static void main(String[] args) {

        StringBuffer sb = new StringBuffer("Java is a programming language : ");

        // use codePointAt(int index) it will return Unicode codepoint 
        // of the character at the specified index

        // Display result after implementing codePointAt(2)

        System.out.println("The result will be after implementing method codePointAt(2) is :" + sb.codePointAt(2));

        sb = new StringBuffer("Java Support OOPS Concept");

        // use codePointAt(int index) it will return Unicode codepoint 
        // of the character at the specified index

        // Display result after implementing codePointAt(5)

        System.out.println("The result will be after implementing method codePointAt(5) is :" + sb.codePointAt(5));
    }
}

Output

D:\Programs>javac StringBufferClass.java

D:\Programs>java StringBufferClass
The result will be after implementing method codePointAt(2) is :118
The result will be after implementing method codePointAt(5) is :83





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.