String.RegionMatches 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
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
对象的子字符串与其他参数的子字符串进行比较。 如果这些子字符串表示相同的字符序列,则结果为 true。 要比较的此String
对象的子字符串从索引toffset
开始,并且长度为 。len
要比较的其他字符串的子字符串从索引 ooffset
开始,并且具有长度 len
。 结果是 false
,仅当以下至少一个为 true 时: <ul><li>toffset
为负数。 <李>ooffset
是负面的。 <li>toffset+len
大于此 String
对象的长度。 <li>ooffset+len
大于另一个参数的长度。 <li>有一些非负整数 k 小于len
这样:this.charAt(toffset +
k) != other.charAt(ooffset +
k)
</ul>
请注意,此方法不<<考虑>区域设置。> 该 java.text.Collator
类提供区分区域设置的比较。
适用于 . 的 java.lang.String.regionMatches(int, java.lang.String, int, int)
Java 文档
本页的某些部分是根据 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
为 true 时)。 要比较的此String
对象的子字符串从索引toffset
开始,并且长度为 。len
要比较的other
子字符串从索引ooffset
开始,长度为 。len
结果是 false
,仅当以下至少一个为 true 时: <ul><li>toffset
为负数。 <李>ooffset
是负面的。 <li>toffset+len
大于此 String
对象的长度。 <li>ooffset+len
大于另一个参数的长度。 <li>ignoreCase
是 false
并且有一些非负整数 k 小于 len
这样: <blockquote>
this.charAt(toffset+k) != other.charAt(ooffset+k)
</blockquote><li>ignoreCase
是 true
一些非负整数 k 小于 len
这样: <blockquote>
Character.toLowerCase(Character.toUpperCase(this.charAt(toffset+k))) !=
Character.toLowerCase(Character.toUpperCase(other.charAt(ooffset+k)))
</blockquote></ul>
请注意,此方法不<<>考虑>区域设置,并且会导致某些区域设置出现ignoreCase
true
不尽如人意的结果。 该 java.text.Collator
类提供区分区域设置的比较。
适用于 . 的 java.lang.String.regionMatches(boolean, int, java.lang.String, int, int)
Java 文档
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。