string.codePointBefore()

String.codePointBefore() Returns the unicode value of the character present before the input position of the string.
Syntax
String.codePointBefore(input)
input is an integer staring from 0 ( first position )

Here are some examples with output.
String my_str="Welcome to plus2net";
System.out.println(my_str.codePointBefore(1)); // 87
System.out.println(my_str.codePointBefore(3)); // 108
System.out.println(my_str.codePointBefore(15)); // 115
If we use input as 0 (first char is at position 0), then we will get error like this

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0

Learn more about unicode values of the Chars here

All String functions


plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer