java.lang.StringBuffer codePointBefore(int index)

Description :

This java tutorial shows how to use the codePointBefore(int index) method of StringBuffer class under java.lang package.

The codePointBefore(int index) returns the character (Unicode code point) before the specified index. The index refers to char values (Unicode code units) and ranges from 1 to length().

Method Syntax :

public int codePointBefore(int index)

Parameter Input :

DataType Parameter Description
int index the index following the code point that we are interested

Method Returns :

The codePointBefore(int index) method simply returns the Unicode code point value before the given index.

Compatibility Version :

Requires Java 1.5 and up

Java Code Example :

This java example source code demonstrates the use of codePointBefore(int index) method of StringBuffer class. Initially the code assigns a string “javatutorialhq.com” as initial contents of the string buffer. Then we use the codePointBefore(int index) of the StringBuffer at index 5.

Sample Output :

Running the codePointBefore(int index) method example source code of StringBuffer class will give you the following output

Exception Scenario :

N/A

Similar Method :

  • N/A

Suggested Reading List :

References :