有啊,用正則表達(dá)式,下面是簡單的例子
創(chuàng)新互聯(lián)建站專注于武義網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供武義營銷型網(wǎng)站建設(shè),武義網(wǎng)站制作、武義網(wǎng)頁設(shè)計、武義網(wǎng)站官網(wǎng)定制、微信小程序服務(wù),打造武義網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供武義網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
Imports?System.Text.RegularExpressions
Public?Class?Form1
Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click
Dim?str?As?String?=?"ABCDAEAFAG"
Dim?Patter?As?String?=?"A"
Dim?Matches?As?MatchCollection?=?Regex.Matches(str,?Patter,?RegexOptions.IgnoreCase?Or?RegexOptions.ExplicitCapture)
For?Each?ws?In?Matches
ListBox1.Items.Add("索引位置:"??ws.index)
Next
End?Sub
End?Class
dim st as string = "qwertyuiop"
msgbox(st.indexof("p"))
若為-1,則表示不存在
簡單點寫。
Module Program
Sub Main()
Console.WriteLine("Hello World!")
Dim t As String, a() As String, c As Integer
t="/admin/index/login/defasd.php"
a=t.Split("/"c)
c=0
For Each p In a
If c0 Then
Console.WriteLine("/"+p)
End If
c+=1
Next
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
End Module
========
Hello World!
/admin
/index
/login
/defasd.php
字符串中指定文字位置查詢,如:instr("inter","er")?
返回待判斷字符串在原字符串中第一次出現(xiàn)的位置,如果不包含的話返回0