DSAPI 提取中間文本(字符串)

提取中間文本(源文本 As String, 前導文本 As String, 結束文本 As String, Optional 移除文本 As String = "", Optional 忽略大小寫 As Boolean = True)spa

 1 Dim S As String = "name:ok,link:none,name:ok2,link:none2"
 2         '提取字符串中"name:"到","之間的字符
 3         Dim SP() As String = DSAPI.字串提取.提取全部中間文本(S, "name:", ",")
 4         For Each M As String In SP
 5             Console.WriteLine(M)
 6         Next
 7         '輸出 ok ok2
 8 
 9 
10         '提取字符串中"link:"到","之間的字符,因爲後面的link後面沒有",",因此提取的時候後面補一下,使得最後一個link也能被捕捉進來
11         SP = DSAPI.字串提取.提取全部中間文本(S & ",", "link:", ",")
12         For Each M As String In SP
13             Console.WriteLine(M)
14         Next
15         '輸出 none none2
16 
17 
18         '提取字符串中的"name:"到",",但只提取第一個匹配的。
19         Console.WriteLine(DSAPI.字串提取.提取中間文本(S, "name:", ","))
20         '輸出 ok
相關文章
相關標籤/搜索