Hi
I'm having a strange error while comparing two strings. Please check the
code below. This is a simple string comparison code and works just fine on
all of my machines. While debugging an issue on a client's machine, who had
turkish windows installed on his system, I found out that this simple piece
of code does'nt work. The messages boxes that are displayed are in this
sequence.
1. to upper works with szWINDOWS
2. to lower does'nt works with szWINDOWS
3. to upper does'nt works with szwindows
4. to lower works with szwindows
It seems like ToUpper and ToLower are'nt working at all and .Equals() method
is being passed the original values of the variables szWINDOWS and
szwindows. Does this problem have anything to do with the Turkish window
that is installed on the client's machine, or is it a known issue.
string szWINDOWS = "WINDOWS";
string szwindows = "windows";
if(szWINDOWS.ToUpper().Equals ("WINDOWS") )
System.Windows.Forms.MessageBox.Show("to upper works with
szWINDOWS");
else
System.Windows.Forms.MessageBox.Show("to upper does'nt works with
szWINDOWS");
if(szWINDOWS.ToLower().Equals ("windows"))
System.Windows.Forms.MessageBox.Show("to lower works with
szWINDOWS");
else
System.Windows.Forms.MessageBox.Show("to lower does'nt works with
szWINDOWS");
if(szwindows.ToUpper().Equals ("WINDOWS"))
System.Windows.Forms.MessageBox.Show("to upper works with
szwindows");
else
System.Windows.Forms.MessageBox.Show("to upper does'nt works with
szwindows");
if(szwindows.ToLower().Equals ("windows"))
System.Windows.Forms.MessageBox.Show("to lower works with
szwindows");
else
System.Windows.Forms.MessageBox.Show("to lower does'nt works with
szwindows");
Regards
Usman