What is different between ToLower And ToLowerInvariant()? [Resolved]

Posted by Kumarkrishna184 under C# on 4/1/2016 | Points: 10 | Views : 11552 | Status : [Member] | Replies : 2
What is different between ToLower And ToLowerInvariant()?

Thanks and Regards,
Krishna Kumar



Responses

Posted by: A2H on: 4/1/2016 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Both methods will convert the input value to small letters.

The difference here is ToLower is depending on current culture(ex: en-US) i.e ToLower method return a copy of this String object converted to lowercase using the casing rules of the specified culture. some time this culture dependency will result in invalid results.

Ex: For alphabhet (i) dot is removed. You can check this link for more details.
http://stackoverflow.com/questions/6600954/c-tolower-is-sometimes-removing-dot-from-the-letter-i

ToLowerInvariant Method will return a copy of this String object converted to lowercase using the casing rules of the invariant culture. ie. this method will convert characters to lowercase without culture dependency.



Thanks,
A2H
My Blog

Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 4/1/2016 [Member] [MVP] Silver | Points: 25

Login to post response