
正文
vb.net字符串查询,vb字符串函数大全
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb.net 中的字符串搜索、查找功能在哪里
有啊,用正则表达式,下面是简单的例子
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
相关问答
Q1: vb.net 字符串的查找?
dim st as string = "qwertyuiop"
msgbox(st.indexof("p"))
若为-1,则表示不存在
Q2: vb.net 查找字符串
简单点写。
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
Q3: 在vb.net中查找一个函数,该函数功能:在原字符串中查找字串是否存在
字符串中指定文字位置查询,如:instr("inter","er")
返回待判断字符串在原字符串中第一次出现的位置,如果不包含的话返回0






