String.StartsWith 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| StartsWith(String, Int32) |
测试从指定索引处开始的此字符串的子字符串是否以指定的前缀开头。 |
| StartsWith(String) |
测试此字符串是否以指定的前缀开头。 |
StartsWith(String, Int32)
测试从指定索引处开始的此字符串的子字符串是否以指定的前缀开头。
[Android.Runtime.Register("startsWith", "(Ljava/lang/String;I)Z", "")]
public bool StartsWith (string prefix, int toffset);
[<Android.Runtime.Register("startsWith", "(Ljava/lang/String;I)Z", "")>]
member this.StartsWith : string * int -> bool
参数
- prefix
- String
前缀。
- toffset
- Int32
在此字符串中开始查找的位置。
返回
true 如果参数所表示的字符序列是从索引 toffset开始的此对象的子字符串的前缀,则为 false ;否则。
结果是如果toffset为负或大于此String对象的长度,则结果false与此.substring(toffset.startsWith(prefix) </pre 的表达式<>结果相同>
- 属性
例外
如果为 .,则为prefix null
注解
测试从指定索引处开始的此字符串的子字符串是否以指定的前缀开头。
适用于 . 的 java.lang.String.startsWith(java.lang.String, int)Java 文档
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。
适用于
StartsWith(String)
测试此字符串是否以指定的前缀开头。
[Android.Runtime.Register("startsWith", "(Ljava/lang/String;)Z", "")]
public bool StartsWith (string prefix);
[<Android.Runtime.Register("startsWith", "(Ljava/lang/String;)Z", "")>]
member this.StartsWith : string -> bool
参数
- prefix
- String
前缀。
返回
true 如果由参数表示的字符序列是此字符串所表示的字符序列的前缀,则为 ; false 否则。
另请注意,true如果参数为空字符串或等于此方法确定的#equals(Object)此String对象,将返回该对象。
- 属性
例外
如果为 .,则为prefix null
注解
测试此字符串是否以指定的前缀开头。
在 1.0 中添加。
适用于 . 的 java.lang.String.startsWith(java.lang.String)Java 文档
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。