• Post Reply Bookmark Topic Watch Topic
  • New Topic

conversion types  RSS feed

 
karthik. G gopalan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
pl let me know the method for converting a String to its equivalent ASCII value with an example.

thank you
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A String does not have "an ASCII value". Characters in a String can be represented by ASCII codes (if they are in the range of characters that's defined by ASCII).

You can use the getBytes(...) method of class String to get a byte array that contains the bytes that represent the characters in a string in a particular character set, such as ASCII. See the API documentation.

[ October 17, 2006: Message edited by: Jesper Young ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!