CompareTo 方法
TOC
摺疊目錄
展開目錄
本文章是由機器翻譯。 將指標移到文章內的文字上方即可查看原文。 其他資訊。
譯文
原文

String.CompareTo 方法

 

Compares this instance with a specified object or String and returns an integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified object or String.

命名空間:   System
組件:  mscorlib (在 mscorlib.dll 中)

名稱描述
System_CAPS_pubmethodCompareTo(Object)

比較這個執行個體與指定的 Object,並且指出這個執行個體在排序次序中,位於所指定 Object 之前、之後或相同位置。

System_CAPS_pubmethodCompareTo(String)

Compares this instance with a specified String object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string.

Both overloads of theOverload:System.String.CompareTo method perform culture-sensitive and case-sensitive comparison. You cannot use this method to perform culture-insensitive or ordinal comparisons. For code clarity, we recommend that you avoid the Overload:System.String.CompareTo method and call the M:System.String.Compare(System.String,System.String) method instead.

回到頁首
顯示:
© 2016 Microsoft