StringSegment.StartsWith(String, StringComparison) 方法

定义

使用指定的 comparisonType 进行比较时,检查此 StringSegment 的开头是否与指定的 String 匹配。Checks if the beginning of this StringSegment matches the specified String when compared using the specified comparisonType.

public:
 bool StartsWith(System::String ^ text, StringComparison comparisonType);
public bool StartsWith (string text, StringComparison comparisonType);
member this.StartsWith : string * StringComparison -> bool
Public Function StartsWith (text As String, comparisonType As StringComparison) As Boolean

参数

text
String

要比较的 StringThe Stringto compare.

comparisonType
StringComparison

一个枚举值,用于指定比较中要使用的规则。One of the enumeration values that specifies the rules to use in the comparison.

返回

Boolean

如果 text 与此 StringSegment 的开头匹配,则为 true;否则为 falsetrue if text matches the beginning of this StringSegment; otherwise, false.

例外

textnulltext is null.

适用于