File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How do i get Ascii Char for given number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do i get Ascii Char for given number" Watch "How do i get Ascii Char for given number" New topic
Author

How do i get Ascii Char for given number

Venkat Injapury
Greenhorn

Joined: May 24, 2001
Posts: 11
Hi folks,
Is there any method to get Ascii character for given numeric value. I found the Character.getNumericValue(Char ch), It will return Unicode numeric value of given character.I couldn't find the method which will return the Character. your help is appreaciated.
Thanks in advance.
Venkat

Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
I'm not sure if this is what you want but...
char c = new Character((char)87).charValue();
c contains then 'W' which is the character with ASCII code 87
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Rowan Brownlee
Ranch Hand

Joined: Aug 07, 2000
Posts: 97
Hi Venkat,
I don't know of a dedicated method as part of the API, but you can try typecasting an integer to a character.
eg. the following loop displays the 'a' to 'z' lowercase.
cheerio
Rowan
public class Test{
public static void main(String args[]){
for(int count = 97; count < 123; count++){
System.out.println((char)count + " " + count);
}
}
}
Venkat Injapury
Greenhorn

Joined: May 24, 2001
Posts: 11
Valentin Crettaz
Thanks it is working fine.
Thanks
Venkat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do i get Ascii Char for given number