JPR105 said:
I am a beginner in Java programming and I would like to know which
code ( program ) I must write to get the Unicode value of any
character ?
I'm not entirely sure what you mean. I could probably be more helpful
if you could specify your input and output more precisely.
If you have the character in a Java 'char' data type, then it *is* the
Unicode value. If you'd like to get the Unicode value in a different
numeric data type, just assign it as such:
char c = 'A';
int unicodeVal = c;
or cast it, if you don't have an appropriate intermediate variable and
the promotion won't be done automatically:
doSomething((int) c);
If your input is in a different type, then it will depend on what that
type is. In general, though, this should be a trivial task.
NOTE: This gets a little more difficult if you want to deal with Unicode
3.0 and surrogates. If that's the situation, then please say so, and
someone will probably give you an answer. It won't be me, unless I have
the chance to learn more about surrogates between now and then.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation