string.compare and string.Equals the difference in usage of culture
Posted on 9/15/2007 12:44:18 AM
in #ASP.NET 2.X
Hi
In the string class we have 2 methods to compare the string. I see most of the developers get confused between the 2. Both string.Compare and string.Equals methods are used for string comparison but they significant difference between them. The use of wrong method can lead to globalization and security issues.
String.Equals perform an ordinal comparison while string.Compare performs a culture sensitive comparison.
string.Compare method also has overload to be given the culture. By default it uses the current culture.
The comparison uses the culture parameter to obtain culture-specific information such as casing rules and the alphabetic order of individual characters. For example, a culture could specify that certain combinations of characters be treated as a single character, or uppercase and lowercase characters be compared in a particular way, or that the sorting order of a character depends on the characters that precede or follow it.
Vikram
|
Posted on 10/1/2007 5:59:28 AM
hai ,
your explanations to the questions is some what little. please explain with little examples ..
thanku for ur valuable service.
|
Posted on 5/4/2008 11:52:47 PM
Hai,
how to compare Datetime in between statement in SQL server 2005.
|