匹配手機號碼

2021-09-06 15:17:41 字數 838 閱讀 8988

1

static

void main(string

args)222

//string pattern = @"^[1]";

23//

regex rx = new regex(pattern);

24//

string input = "18817889736 23487 3241247531432 432432145 15895565819 1834765 13";

25//

matchcollection matches = rx.matches(input);

26//

foreach(match match in matches)

27//

30 }

3.3 matchcollection 類表示非重疊匹配的序列

該集合為唯讀的,並且沒有公共建構函式。matchcollection 的例項是由 regex.matches 屬性返回的。使用 regex 類的 matches 方法,通過在輸入字串中找到的所有匹配填充 matchcollection。下面**示例演示了如何將集合複製到乙個字串陣列(保留每一匹配)和乙個整數陣列(指示每一匹配的位置)中。

matchcollection mc;

string results = new string[20];

int matchposition = new int[20];

regex r = new regex("abc"

mc = r.matches("123abc4abcd"

for (int i = 0; i 

獲取手機號碼

使用telephonymanager.getdefault getline1number 已經不能獲得目前移動sim卡的 號碼了,老的sim卡也許可以,現在介紹一種方法,可以獲得手機號碼 cursor mycursor getcontentresolver query uri.parse conte...

手機號碼驗證

正規表示式的使用 正規表示式的元素符及其意義 元素符正規表示式中的寫法意義.代表任意乙個字元 d d 代表0 9的任意乙個數字 d d 代表任何乙個非數字字元 s s 代表空白字元,如 t n s s 代表非空白字元 w w 代表可用作識別符號的字元,但不包括 符 w w 代表不可用於識別符號的字元...

vba手機號碼歸屬 手機號碼歸屬地查詢

本 示例是基於php的聚合資料 手機號碼歸屬地查詢api服務請求的 樣例,使用前你需要 通過 此介面每日免費100次請求 聚合資料 手機號碼歸屬地查詢api header content type text html charset utf 8 apiurl params array phone 1...