Unicode Character Values

Aran Winters

Greenhorn

Posts: 11

posted 12 years ago

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).

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

Aran.

Layne Lund

Ranch Hand

Posts: 3061

posted 12 years ago

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.

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.