Reputation: 27387
I create wpf application. And some case I compare two string values. local value comes from richtextbox, and richtextbox value comes from word document. I try every solution on this site. But nothing changed. The comparision equal to false. I try replace end of file with linkedWord.Replace((char)160, (char)32);
Try string.Compare
String.Compare(wr.Orthography, linkedWord, StringComparison.OrdinalIgnoreCase) == 0
Use Encoding to byte array and SequanceEqual and more, but can not find solution. Please help me to solve this problem.
The value comes from richtextbox:
the value comes from database:
EDIT:
After Compare method result is -1
Upvotes: 0
Views: 265
Reputation: 1155
The reason is probably that cyrillic ә(ә) and latin ə(ə) are different though they look same.
Check each character for equality, below you can see the difference:
foreach (char c in "bәse")
Console.Write(((int)c).ToString("0000"));
Console.WriteLine("\n--------------------");
foreach (char c in "bəse")
Console.Write(((int)c).ToString("0000"));
Console.WriteLine("\n--------------------");
Console.WriteLine(("bәse"=="bəse").ToString());
Output
0098124101150101
--------------------
0098060101150101
--------------------
False
In this case you should replace the cyrillic chars with latin counterparts
You can see here and also check here, it seems like there is a library that can be used in this case
Upvotes: 1