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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA