다음을 통해 공유


StringBuilder.CompareTo(StringBuilder) Method

Definition

Compares two StringBuilder instances lexicographically.

[Android.Runtime.Register("compareTo", "(Ljava/lang/StringBuilder;)I", "", ApiSince=34)]
public int CompareTo (Java.Lang.StringBuilder another);
[<Android.Runtime.Register("compareTo", "(Ljava/lang/StringBuilder;)I", "", ApiSince=34)>]
member this.CompareTo : Java.Lang.StringBuilder -> int

Parameters

another
StringBuilder

the StringBuilder to be compared with

Returns

the value 0 if this StringBuilder contains the same character sequence as that of the argument StringBuilder; a negative integer if this StringBuilder is lexicographically less than the StringBuilder argument; or a positive integer if this StringBuilder is lexicographically greater than the StringBuilder argument.

Attributes

Remarks

Compares two StringBuilder instances lexicographically. This method follows the same rules for lexicographical comparison as defined in the java.lang.CharSequence#compare(java.lang.CharSequence, java.lang.CharSequence) CharSequence.compare(this, another) method.

For finer-grained, locale-sensitive String comparison, refer to java.text.Collator.

Added in 11.

Java documentation for java.lang.StringBuilder.compareTo(java.lang.StringBuilder).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to