Javatpoint Logo
Javatpoint Logo

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()




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA