Compare()

String::Compare(const String&, int, const String&, int, int, bool) method

Less-equal-greater-compares two substrings.

static int System::String::Compare(const String &strA, int indexA, const String &strB, int indexB, int length, bool ignoreCase=false)

Arguments

ParameterTypeDescription
strAconst String&First string to compare.
indexAintBeginning of first string substring.
strBconst String&Second string to compare.
indexBintBeginning of the second string substring.
lengthintNumber of characters to compare.
ignoreCaseboolSpecifies whether comparison is case-insensitive.

Return Value

Negative value if first substring is less then second, zero if they match, positive value otherwise.

String::Compare(const String&, int, const String&, int, int, bool, const SharedPtr<System::Globalization::CultureInfo>&) method

Less-equal-greater-compares two substrings.

static int System::String::Compare(const String &strA, int indexA, const String &strB, int indexB, int length, bool ignoreCase, const SharedPtr<System::Globalization::CultureInfo> &ci)

Arguments

ParameterTypeDescription
strAconst String&First string to compare.
indexAintBeginning of first string substring.
strBconst String&Second string to compare.
indexBintBeginning of the second string substring.
lengthintNumber of characters to compare.
ignoreCaseboolSpecifies whether comparison is case-insensitive.
ciconst SharedPtr<System::Globalization::CultureInfo>&Culture to use for comparison.

Return Value

Negative value if first substring is less then second, zero if they match, positive value otherwise.

String::Compare(const String&, const String&, System::StringComparison) method

Less-equal-greater-compares two strings.

static int System::String::Compare(const String &strA, const String &strB, System::StringComparison comparison_type)

Arguments

ParameterTypeDescription
strAconst String&First string to compare.
strBconst String&Second string to compare.
comparison_typeSystem::StringComparisonComparison mode.

Return Value

Negative value if first substring is less then second, zero if they match, positive value otherwise.

String::Compare(const String&, int, const String&, int, int, System::StringComparison) method

Less-equal-greater-compares two strings.

static int System::String::Compare(const String &strA, int indexA, const String &strB, int indexB, int length, System::StringComparison comparison_type)

Arguments

ParameterTypeDescription
strAconst String&First string to compare.
indexAintBeginning of first string substring.
strBconst String&Second string to compare.
indexBintBeginning of the second string substring.
lengthintNumber of characters to compare.
comparison_typeSystem::StringComparisonComparison mode.

Return Value

Negative value if first substring is less then second, zero if they match, positive value otherwise.

String::Compare(const String&, const String&, bool) method

Less-equal-greater-compares two strings.

static int System::String::Compare(const String &strA, const String &strB, bool ignoreCase=false)

Arguments

ParameterTypeDescription
strAconst String&First string to compare.
strBconst String&Second string to compare.
ignoreCaseboolSpecifies whether comparison is case-insensitive.

Return Value

Negative value if first substring is less then second, zero if they match, positive value otherwise.

String::Compare(const String&, const String&, bool, const SharedPtr<System::Globalization::CultureInfo>&) method

Less-equal-greater-compares two strings.

static int System::String::Compare(const String &strA, const String &strB, bool ignoreCase, const SharedPtr<System::Globalization::CultureInfo> &ci)

Arguments

ParameterTypeDescription
strAconst String&First string to compare.
strBconst String&Second string to compare.
ignoreCaseboolSpecifies whether comparison is case-insensitive.
ciconst SharedPtr<System::Globalization::CultureInfo>&Culture to use for comparison.

Return Value

Negative value if first substring is less then second, zero if they match, positive value otherwise.

See Also