File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unicode Character Values

 
Aran Winters
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to convert between integers and characters for the purpose
of writing a class to sort strings alphabetically.

I found a method to convert from character to integer
(--> java.lang.Character.getNumericValue() <--),
but have not been able to find a method which allows
be to provide an integer argument returning a character
(according to the Unicode value).

I have looked over the methods in the java.lang.Character
and java.lang.Integer classes, but was not successful in
finding what I need.

If someone could point me in the right direction I would
appreciate it.

Aran.
 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not quite clear on what you are attempting to do. What kind of conversion are you trying to do? There are several kinds. For example the character 'A' has an underlying numerical value (I'm not sure what it is). Similarly all characters have a numerical value (as far as I know). On the other hand, you may be attempting to take the character '1' and get the integer value 1. I am sure that someone else can dream up yet another definition of "convert between integers and characters". Can you please give a more detailed description of what you want? Perhaps some examples to illustrate the expected input and output for this portion of your program will help clear things up.

Regards,

Layne
 
Nick George
Ranch Hand
Posts: 815
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand you correctly, it's alot easier than you think

'A' == (char) 65
(int)'A' == 65
 
Aran Winters
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I wasn't more clear,

I was trying to convert single chars ('A'), into their underlying
numerical values. I think the unicode values are offset differently,
but the second reply still does the trick. Thanks for all the
responses.

Aran.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic