使用正則表達式我有格式的字符串數值的字符串:分裂在VB.NET
"one two 33 three"
我需要將其分裂上的數字值,使得我得到長度爲2的數組:
"one two"
"33 three"
或長度3的數組:
"one two"
"33"
"three"
我試圖Regex.Split(str,"\D+")
但它給了我:
""
"33"
""
和Regex.Split(str,"\d+")
遞給我:
"one two"
"three"
和Regex.Split(str,"\d")
遞給我:
"one two"
""
"three"
所以沒有給我想要的結果。誰能幫忙?
工作就像一個魅力!你能向我解釋它究竟做了什麼?謝謝 – ElenaDBA 2014-12-05 17:06:36
@ElenaDBA請參閱編輯 – vks 2014-12-05 17:08:34
這將給你一個字符串'two'旁邊的空格 – 2014-12-05 17:09:16