Unicode code point in string.



Internally in Java all strings are kept in unicode. Since not all text received from users or the outside world is in unicode, your application may have to convert from non-unicode to unicode. Additionally, when the application outputs text it may have to convert the internal unicode format to whatever format the outside world needs.

You see that unicode point of string using codePointBefore() mehtod.

public class StringUniCode{
   public static void main(String[] args){
      String test_string="Welcome to JAVAinfo";
      System.out.println("String under test is = "+test_string);
      System.out.println("Unicode code point at" 
      +" position 5 in the string is = "
      +  test_string.codePointBefore(5));
   }
}

Comments