Unicode value of a character

Discussion in 'Java' started by JPR105, Apr 25, 2004.

  1. JPR105

    JPR105 Guest

    Hi,

    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 ?

    Thank you very much for your help !

    JPR105.
     
    JPR105, Apr 25, 2004
    #1
    1. Advertising

  2. On 25 Apr 2004 06:12:40 -0700, JPR105 wrote:

    > I am a beginner in Java programming


    A much nicer group is this one..
    <http://www.physci.org/codes/javafaq.jsp#cljh>

    Some of the people here are
    just horrible, I've heard. ;-)

    >...and I would like to know which
    > code ( program ) I must write to get the Unicode value of any
    > character ?


    _Any_ character? Here's three..
    <http://www.physci.org/codes/char.jsp>
    <http://www.physci.org/codes/char.jsp?char=174>
    <http://www.physci.org/codes/char.jsp?char=937>

    You can also trawl though the charset here..
    <http://www.physci.org/codes/charset.jsp?frame=1>

    HTH

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, Apr 25, 2004
    #2
    1. Advertising

  3. JPR105

    Chris Smith Guest

    JPR105 wrote:
    > 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
     
    Chris Smith, Apr 25, 2004
    #3
  4. JPR105

    Roedy Green Guest

    On 25 Apr 2004 06:12:40 -0700, (JPR105) wrote or
    quoted :

    >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 ?


    see http://mindprod.com/jgloss/unicode.html

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Apr 26, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. david
    Replies:
    7
    Views:
    11,823
    Ricardo Dominguez
    Oct 10, 2012
  2. jackie
    Replies:
    2
    Views:
    2,053
    E. R. Jacobson
    Jan 7, 2005
  3. Kenneth McDonald
    Replies:
    1
    Views:
    899
    Carl Banks
    Dec 27, 2006
  4. George2
    Replies:
    2
    Views:
    415
    James Kanze
    Jan 25, 2008
  5. Tyler
    Replies:
    1
    Views:
    1,012
    Robert Klemme
    Jul 29, 2011
Loading...

Share This Page