How to determinate if a stirng is Chinese or English

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I use a TextBox for to enter an string.
How can I determiniate if the stirng is Chinese or English?
 
ad said:
I use a TextBox for to enter an string.
How can I determiniate if the stirng is Chinese or English?

Well, you could check if every character is ASCII (i.e. has a Unicode
value < 128). If so, it can't be Chinese. On the other hand, that won't
catch words with accents in. What would you want to happen if someone
entered half a Chinese word and half an English word?
 
Im guessing you have to change the settings on the PC to enter chinese
characters?

If so you can use the

System.Globalization.CultureInfo.CurrentCulture

property to get the culture which the current thread is using
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top