String.Matches(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷此字串是否符合給定的正則表達式。
[Android.Runtime.Register("matches", "(Ljava/lang/String;)Z", "")]
public bool Matches(string regex);
[<Android.Runtime.Register("matches", "(Ljava/lang/String;)Z", "")>]
member this.Matches : string -> bool
參數
- regex
- String
此字串所對應的正則表達式
傳回
true 當且僅當該字串與給定的正則表達式相符
- 屬性
例外狀況
如果 regularExpression == null
備註
判斷此字串是否符合給定的正則表達式。
以 str.matches(regex) 形式呼叫此方法,結果與表達式完全相同
<引用>java.util.regex.Pattern。java.util.regex.Pattern#matches(String,CharSequence) matches(<i>regex</i>, <i>str</i>)</區塊引用>
在 1.4 版本加入。
Java 文件 java.lang.String.matches(java.lang.String)。
此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。