In .net fx i can do
myString.ToLower(frenchCulture);
But when looking at .net core or .net standard there is no more a culture parameter that can be passed. There is only string.ToLower()
and string.ToLowerInvariant()
Should the culture just be ommitted ? But shouldn't then there be issues when the culture of the string is not the current culture?
Any hints what the reason behind this is?
When I have the idea of a invariant culture I can use ToLowerInvariant()
.
But what about use cases where i have to use string.ToLower()
in a culture that is not the current culture?
This method is used to return a copy of the current string converted to lowercase. Syntax: public string ToLower (); Return Type: It return the string value, which is the lowercase equivalent of the string of type System.
ToLower() Returns a copy of this string converted to lowercase.
The other three are mostly the same. But in general, ToLowerInvariant is fastest, then ToUpper and then ToUpperInvariant .
It looks like the capability is there, just in a more roundabout way. Instead of:
string output = input.ToLower(culture);
use
string output = culture.TextInfo.ToLower(input);
Also note that the overload has been added in netstandard2.0. The implementation is basically the code above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With