Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any 'is doublt-byte character' function?

Status
Not open for further replies.

iamanson

Programmer
Aug 17, 2001
42
AU
Hi,
Is there any way to find doyble-byte character in C#?
I tried IsLetter but it get both alphabet and double byte characters.

Thanks!
 
Usually, there is no such thing as a double-byte character in .NET -- it uses UTF-16 Unicode, in which *every* character is expressed by two bytes.

However, if you're reading a file or stream that is coming in as a multi-byte character set (something like Shift-JIS or UTF-8), then you'll have to write code to convert it to UTF-16, or use one of the built-in Convert methods (in the case of UTF-8).

Chip H.
 
Thanks.
I think I did't write clearly.
I mean, for example, I need to extract all double byte character (something like Shift-JIS or UTF-8) but not alphabets from a file

How can I do that?
 
You'll need to learn more about the particular multi-byte encoding that you'll be receiving -- they all do it differently.

I haven't done any work with Shift-JIS, but in UTF-8, the first byte in a multi-byte sequence are always "11vvvvvv", with subsequent bytes "10vvvvvv". Take a look at:
Google will be your friend in this, I'm afraid.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top