all groups > c# > april 2004 >
You're in the

c#

group:

converting UCS2 character code to a string


converting UCS2 character code to a string PEACEMAKER
4/25/2004 11:32:28 PM
c#:
I have a bunch of ucs2 character code reference numbers like 672c. Is there
an easy way to convert these to a c# string so that when it is printed out
in the appropriate font it displays the character?

Re: converting UCS2 character code to a string Jon Skeet [C# MVP]
4/26/2004 9:36:27 AM
[quoted text, click to view]

You can cast an int to a char (although you'll get unwanted results if
the value is > 0xffff). You can create a string from an array of chars,
or you could use a StringBuilder and repeatedly call Append, for
example.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
AddThis Social Bookmark Button