Click here to Skip to main content
14,267,879 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hallo, i have string array "words" with special characters and i want to replace it with normal characters. I compare text in label (words with special characters) with text in textbox, wich user will write (words WITHOUT special characters).Example:
string[] words = { "čau", "tschüs" };
string blahblah = words[random.Next(words.Length)];
            label.Text = blahblah;
if (label.Text == textbox.Text)
            {
                do something...
            }

And i need output to be: "cau" and "tschus"... If in label will be "čau" and user write to textbox "cau" it will compare it as a same word.
Can anybody help me?
Thank you for answer.
Posted
Comments
Tomas Takac 18-Feb-15 12:37pm
   
Richard Deeming 18-Feb-15 13:00pm
   
You should post that as a solution. :)
Sergey Alexandrovich Kryukov 18-Feb-15 12:48pm
   
Why? Want to give up on correct spelling of Unicode text? :-)
—SA
Richard MacCutchan 18-Feb-15 13:32pm
   
You should just set a translation table for the special characters that you are interested in and use that to do that changes. Creating a list of all possible words would take forever.
Member 10808387 18-Feb-15 13:41pm
   
And how do I do that? What translation table? I will not write all possible words, I have only few, that i choose. :)
Richard MacCutchan 18-Feb-15 13:47pm
   
A translation table in this case would only require two sets of characters. Look up the special character in table 1 and use the find index to locate the corresponding non-special character. Pretty simple piece of code.
OriginalGriff 18-Feb-15 14:05pm
   
No need for a translation table:
https://msdn.microsoft.com/en-us/library/system.string.normalize(v=vs.110).aspx

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100