Java StringBuilder codePointBefore() Method Example

Java StringBuilder codePointBefore(int index) method 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().

Java StringBuilder codePointBefore() Method Example

public class CodePointBeforeExample {
    public static void main(String[] args) {
         StringBuilder builder = new StringBuilder("javaguides");
         int unicode = builder.codePointBefore(1);
         System.out.println("the character (Unicode code point) at the before specified index is :: " + unicode);
    }
}
Output:
the character (Unicode code point) at the before specified index is :: 106

Reference


Comments