C#- ToLower() is sometimes removing dot from the letter "I"
We have noticed a weird error when calling ToLower() on certain strings.
The input string is:
string s = "DocumentInfo";
string t = s.ToLower();
// sometimes, t == documentinfo
// other times, t == documentınfo (note dot is missing from i - INCORRECT)
We are passing the string to a web service query downstream, so it is causing problems for us.
My initial guess is that it has something to do with Culture or开发者_如何学Python UICulture, as some of our pages customize these settings per user.
Could this be the issue? Is there are way I can force this to work properly?
UPDATE 2011.07.06
I found that I could duplicate the issue by setting Culture to tr-TR. Not sure if other cultures are impacted.
Try using String.ToLowerInvariant()
.
Try :
s.ToLower(new CultureInfo("en-US", false));
If you get a different result, your CultureInfo.CurrentCulture may be set to something else.
精彩评论