Hi guys,

is there any build-in function in C# that can detect if a string contain Chinese/Japanese character? This string may contain alphabet, numeric, chinese and japanese characters. Appreciate any advice please. Thanks in advance!

Cheers,
Mark

Hi guys,

Sorry i am really i dumbass. below are the solution:

string word = textBox1.Text.Trim();
            bool containUnicode = false;
            for (int x = 0; x < word.Length; x++)
            {
                if (char.GetUnicodeCategory(word[x]) == UnicodeCategory.OtherLetter)
                {
                    containUnicode = true;
                    break;
                }
            }
            if (containUnicode)
            {
                MessageBox.Show("contain unicode");
            }
            else
            {
                MessageBox.Show("does not contain unicode");
            }

Enjoy!

Cheers,
Mark Thien

Thank you very much. You save my day.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.