Following example shows how to get unicode point of a character in a String using str.codePointAt(int position) method.
Sample Program
package com.javatutorialcorner.javastring;
public class StringUnicode {
public static void main(String[] args) {
String jtc = "Java tutorials corner contains tutorials for Java programers day to day needs tutorials like Java, Spring, Hibernate, String, JSON, Jackson, GSON, XML parsing, Web Service, SOAP Web Service, RESTful Web Service";
int position = 6;
System.out.println("String input : " + jtc);
System.out.println("Unicode point at position " + position
+ " in the String " + jtc.codePointAt(position));
}
}
Result
The above code will produce the following output.
String input : Java tutorials corner contains tutorials for Java programers day to day needs tutorials like Java, Spring, Hibernate, String, JSON, Jackson, GSON, XML parsing, Web Service, SOAP Web Service, RESTful Web Service
Unicode point at position 6 in the String 117
0 comments:
Post a Comment