Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System Namespace
String Class
String Methods
Compare Method

  Switch on low bandwidth view
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
String..::.Compare Method

Compares two specified String objects and returns an integer that indicates their relationship to one another in the sort order.

  NameDescription
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, String)Compares two specified String objects and returns an integer that indicates their relationship to one another in the sort order.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, String, Boolean)Compares two specified String objects, ignoring or honoring their case, and returns an integer that indicates their relationship to one another in the sort order.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, String, StringComparison)Compares two specified String objects. A parameter specifies whether the comparison uses the current or invariant culture, honors or ignores case, and uses word or ordinal sort rules. The method returns an integer that indicates the relationship of the two String objects to one another in the sort order.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, String, Boolean, CultureInfo)Compares two specified String objects, ignoring or honoring their case, and using culture-specific information to influence the comparison, and returns an integer that indicates their relationship to one another in the sort order.
Public methodStatic memberCompare(String, String, CultureInfo, CompareOptions)Compares two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, Int32, String, Int32, Int32)Compares substrings of two specified String objects and returns an integer that indicates their relative position in the sort order.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, Int32, String, Int32, Int32, Boolean)Compares substrings of two specified String objects, ignoring or honoring their case, and returns an integer that indicates their relationship to one another in the sort order.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, Int32, String, Int32, Int32, StringComparison)Compares substrings of two specified String objects and returns an integer that indicates their relationship to one another in the sort order.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCompare(String, Int32, String, Int32, Int32, Boolean, CultureInfo)Compares substrings of two specified String objects, ignoring or honoring their case and using culture-specific information to influence the comparison. The method returns an integer that indicates their relationship to one another in the sort order.
Public methodStatic memberCompare(String, Int32, String, Int32, Int32, CultureInfo, CompareOptions)Compares substrings of two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in the sort order.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
More information on comparing strings      David M. Kean   |   Edit   |   Show History

For more information on the correct way to compare strings, see the following article:

New Recommendations for Using Strings in Microsoft .NET 2.0
http://msdn2.microsoft.com/en-us/library/ms973919.aspx

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker