Java String codePointAt Example
String class codePointAt method example
String class codePoint method example. This example shows you how to use codePointAt method. This method returns the Unicode number images of characters at the defined indexes in parentheses
Syntax:-codePointAt(int index)
Here is the code:-
/**
* @(#) CodePointAtString.java
* CodePointAtString class demonstrates the working of codePointAt() method of String class of lang package
* @version 13-May-2008
* @author Rose India Team
*/
public class CodePointAtString {
public static void main(String args[]){
String str = "Mutation", str1 = " is the key to revolution", str2 = str + str1;
System.out.println(str2);
int Image, Image1, Image2, Image3, Image4,Image5,Image6, Image7, Image8, Image9;
Image = str2.codePointAt(0);
Image1 = str2.codePointAt(1);
Image2 = str2.codePointAt(2);
Image3 = str2.codePointAt(3);
Image4 = str2.codePointAt(4);
Image5 = str2.codePointAt(5);
Image6 = str2.codePointAt(6);
Image7 = str2.codePointAt(7);
Image8 = str2.codePointAt(8);
Image9 = str2.codePointAt(9);
System.out.println("Unicode number images of characters of the word 'Mutation' are mentioned below as per increasing order of their index location i.e. from 0-9");
System.out.println("{" + Image + "}"+ " " + "{" + Image1 + "}"+ " "+ "{" + Image2 + "}"+ " "+ "{" + Image3 + "}"+ " "+ "{" + Image4 + "}"
+ " "+ "{" + Image5 + "}"+ " "+ "{" + Image6 + "}"+ " "+ "{" + Image7 + "}"+ " "+ "{" + Image8 + "}"+ " "+ "{" + Image9 + "}");
}
} |
Output of the program.
Mutation is the key to revolution
Unicode number images of characters of the word 'Mutation' are mentioned below as per increasing order of their index location from 0-9
{77} {117} {116} {97} {116} {105} {111} {110} {32} {105 |
|