Home » C# String CompareTo() method

C# String CompareTo() method

by Online Tutorials Library

C# String CompareTo()

The C# CompareTo() method is used to compare String instance with a specified String object. It indicates whether this String instance precedes, follows, or appears in the same position in the sort order as the specified string or not.

Signature

Parameters

str: it is a string argument which is used to compare.

Return

It returns an integer value.


C# String CompareTo() Method Example

Output:

0 1 
Next TopicC# String Concat()

You may also like