Grant,


I could parse the 4 character string as follows:
      int charValue =  Integer.parseInt(myString, 16); // myString = "25B5"
      char retValue = (char) charValue;

But I'm worndering if there is any class library (extensively dealing with unicode characters) available

to convert a string like "R = \\u0394y\\u2215\\u0394x" into the character array
[0] = 'R'
[1] = ' ' // space
[2] = '='
[3] = ' ' // space
[4] = '\u0394' // mathematical symbol delta
[5] = 'y'
[6] = '\u2215' // Division symbol
[7] = '\u0394'
[8] = 'x'


Thanks for your help.

Ram Achanta



From: Grant Gainey <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [Juglist] Unicode question
Date: Tue, 08 Jul 2003 09:51:00 -0400

Richard O. Hammer wrote:

Ramanand Achanta wrote:

How can I  convert the
          String unicodeString = "\\u25b5";
to
          char unicodeChar = '\u25b5';     // Result

I think you have made a mistake in writing "\\u25b5", since that represents six unicode characters and not one. You must mean "\u25b5" instead.


You could say
   String unicodeString = "\u25b5";
   char unicodeChar = unicodeString.charAt(0);

Hmmm. I assumed that the OP was asking for a way to get from those 7 characters to the
Unicode character they describe. Imagine parsing a string that has escaped Unicode
sequences in it, for example.


Ramanand, have you looked at CharSet and CharSetDecoder? If you parse the "25b5"
into a byte[], those may be what you need.


Grant

--
_________________________________________________________________________
"In theory, there is no difference between theory and practice. In practice, there is no relationship between theory and practice."



_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to