Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ASCII values
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
haz1487




PostPosted: Wed Nov 14, 2007 12:16 am   Post subject: ASCII values

Hey I was wondering if there was a way of getting the ASCII value of a character in JAVA. Similar to the ord command in turing.

And if possible can you tell me how to print those values as characters?
Sponsor
Sponsor
Sponsor
sponsor
zylum




PostPosted: Wed Nov 14, 2007 2:04 am   Post subject: RE:ASCII values

cast it to int and print that.
HeavenAgain




PostPosted: Wed Nov 14, 2007 12:10 pm   Post subject: RE:ASCII values

you are asking for ord, and yet you are asking "how to print those values as characters"

but cast to int and char will work for both cases Razz
code:
System.out.print((int)'a'+" "+(char)95);

casting rule! (sometimes)
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: