Help - Search - Members - Calendar
Full Version: Tolowerinvariant?
Sal's RuneScape Forum > Everything... Not RuneScape > Tech Talk > Programming & Web Development
Roy
What would this do with the string?

CODE
Stringvar.ToLowerInvariant()


I only see it go to lowercase but then it's the same as ToLower so there has to be something more, or not?
Yippee
Maybe this will help? http://msdn.microsoft.com/en-us/library/sy...rinvariant.aspx

It's culture insensitive...whatever that means...
Roy
QUOTE (Yippee @ Aug 6 2009, 01:53 AM) *
Maybe this will help? http://msdn.microsoft.com/en-us/library/sy...rinvariant.aspx

It's culture insensitive...whatever that means...

I also found that site before this topic but I have no idea what it means...
QUOTE
Returns a copy of this String object converted to lowercase using the casing rules of the invariant culture.

using the what of the what?
Yippee
I think I found what you need... Here: http://msdn.microsoft.com/en-us/library/ms994325.aspx

QUOTE
Culture, which is indicated by the Thread.CurrentCulture property, corresponds by default to the selection in Regional Options in the control panel. This affects how numbers, dates, and times are formatted, and is also what determines which sorting and casing rules to use. This is the property we are concerned with here.

...

The most commonly used routines that have this variation in behavior, depending on the culture, are String.Compare, String.ToUpper and String.ToLower. There are also some other important routines that call these, and which pass on the default behavior.

Whether or not you want these operations to vary depending on the culture depends a lot on what you are doing. If you are displaying a sorted list of localized strings in a list box, then you probably do want a culturally-aware comparison. If you are comparing a string to see if it is a recognized XML tag, then you do not want any variation. Most routines that have culture-dependent behavior will give you the option of passing in the culture to use directly; passing in CultureInfo.InvariantCulture is the way to eliminate the variation.
Roy
QUOTE (Yippee @ Aug 7 2009, 02:16 PM) *
I think I found what you need... Here: http://msdn.microsoft.com/en-us/library/ms994325.aspx

QUOTE
Culture, which is indicated by the Thread.CurrentCulture property, corresponds by default to the selection in Regional Options in the control panel. This affects how numbers, dates, and times are formatted, and is also what determines which sorting and casing rules to use. This is the property we are concerned with here.

...

The most commonly used routines that have this variation in behavior, depending on the culture, are String.Compare, String.ToUpper and String.ToLower. There are also some other important routines that call these, and which pass on the default behavior.

Whether or not you want these operations to vary depending on the culture depends a lot on what you are doing. If you are displaying a sorted list of localized strings in a list box, then you probably do want a culturally-aware comparison. If you are comparing a string to see if it is a recognized XML tag, then you do not want any variation. Most routines that have culture-dependent behavior will give you the option of passing in the culture to use directly; passing in CultureInfo.InvariantCulture is the way to eliminate the variation.


Kk and does it have any good use for programming other than that the code would have a slightly other behavior in certain places?
Yippee
I'm guessing not. Don't yell at me if I'm wrong, though, I don't program in that language, lol.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.