String.RegionMatches 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| RegionMatches(Int32, String, Int32, Int32) |
測試兩個弦區域是否相等。 |
| RegionMatches(Boolean, Int32, String, Int32, Int32) |
測試兩個弦區域是否相等。 |
RegionMatches(Int32, String, Int32, Int32)
測試兩個弦區域是否相等。
[Android.Runtime.Register("regionMatches", "(ILjava/lang/String;II)Z", "")]
public bool RegionMatches(int toffset, string other, int ooffset, int len);
[<Android.Runtime.Register("regionMatches", "(ILjava/lang/String;II)Z", "")>]
member this.RegionMatches : int * string * int * int -> bool
參數
- toffset
- Int32
此字串子區域的起始偏移量。
- other
- String
弦論證。
- ooffset
- Int32
字串參數中子區域的起始偏移量。
- len
- Int32
要比較的字元數量。
傳回
true 如果該字串指定的子區域與該字串參數的指定子區域完全相符; false 否則,
- 屬性
例外狀況
若 string 是 null。
備註
測試兩個弦區域是否相等。
此物件的 String 子字串與參數 other 的子字串進行比較。 若這些子串代表相同的字元序列,則該結果為真。 此物件的 String 子串從索引 toffset 開始,長度為 len。 被比較對象的子串從索引 ooffset 開始,長度為 len。 結果當 false 且僅當以下至少一項為真: <ul><li>toffset 為負值。
<李>ooffset 是陰性。
<Li>toffset+len 大於此 String 物體的長度。
<LI>ooffset+len 大於另一個論點的長度。
<li>存在一個小於 len 的非負整數,使得 this.charAt(toffset +k) != other.charAt(ooffset +k)</ul>
請注意,這種方法是否會<><>考慮地點因素。 該 java.text.Collator 類別提供區域敏感比較。
Java 文件 java.lang.String.regionMatches(int, java.lang.String, int, int)。
此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。
適用於
RegionMatches(Boolean, Int32, String, Int32, Int32)
測試兩個弦區域是否相等。
[Android.Runtime.Register("regionMatches", "(ZILjava/lang/String;II)Z", "")]
public bool RegionMatches(bool ignoreCase, int toffset, string other, int ooffset, int len);
[<Android.Runtime.Register("regionMatches", "(ZILjava/lang/String;II)Z", "")>]
member this.RegionMatches : bool * int * string * int * int -> bool
參數
- ignoreCase
- Boolean
若 true,則在比較字元時忽略格。
- toffset
- Int32
此字串子區域的起始偏移量。
- other
- String
弦論證。
- ooffset
- Int32
字串參數中子區域的起始偏移量。
- len
- Int32
要比較的字元數量。
傳回
true 如果該字串指定的子區域與該字串參數的指定子區域相符; false 否則, 匹配是精確還是不分格,取決於論點本身。ignoreCase
- 屬性
例外狀況
若 string 是 null。
備註
測試兩個弦區域是否相等。
此物件的 String 子字串與參數 other的子字串 比較。 若這些子串代表相同的字元序列,則忽略當且僅當 true 為真時,則為ignoreCase結果。 此物件的 String 子串從索引 toffset 開始,長度為 len。 要比較的 other 子串從索引 ooffset 開始,長度為 len。 結果當 false 且僅當以下至少一項為真: <ul><li>toffset 為負值。
<李>ooffset 是陰性。
<Li>toffset+len 大於此 String 物體的長度。
<LI>ooffset+len 大於另一個論點的長度。
<LI>ignoreCase 是 false ,且存在某個非負整數 k 小於 len ,使得: <引用區塊>
this.charAt(toffset+k) != other.charAt(ooffset+k)
</blockquote><li>ignoreCase 是true,且存在某個小於 len 的非負整數,使得:<blockquote>
Character.toLowerCase(Character.toUpperCase(this.charAt(toffset+k))) !=
Character.toLowerCase(Character.toUpperCase(other.charAt(ooffset+k)))
</blockquote></ul>
請注意,此方法是否考慮 <locale><>,當 ignoreCase 為 true時,某些 locales 會產生不理想的結果。 該 java.text.Collator 類別提供區域敏感比較。
Java 文件 java.lang.String.regionMatches(boolean, int, java.lang.String, int, int)。
此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。