Dim str As String = "A;B=w;C=x;D=y;E=z;"
10余年的淇縣網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都營(yíng)銷網(wǎng)站建設(shè)的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整淇縣建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“淇縣網(wǎng)站設(shè)計(jì)”,“淇縣網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
Dim reg As New System.Text.RegularExpressions.Regex("\w+;\w+=\w+;\w+=(?x\w+);\w+=(?y\w+);\w+=(?z\w+);")
Dim m As System.Text.RegularExpressions.Match=reg.Match(str)
If m.Success Then
MsgBox("x="+m.Groups("x").Value.ToString)
MsgBox("y="+m.Groups("y").Value.ToString)
MsgBox("z="+m.Groups("z").Value.ToString)
endif
調(diào)用 腳本解析引擎,
textbox2.text=Eval(textbox1.text).ToString()
Function?Eval(ByVal?Expressions?As?String)?As?Double
Dim?Mssc?=?CreateObject("MSScriptControl.ScriptControl")
Mssc.Language?=?"vbscript"
Return?CDbl(?Mssc.Eval(Expressions))
End?Function
不喜歡上面提示的警告的話
textbox2.text=EvalString(textbox1.text)
Function?EvalString(ByVal?Expressions?As?String)?As?String
dim?oType?=?System.Type.GetTypeFromProgID("MSScriptControl.ScriptControl")
Dim?o?=?System.Activator.CreateInstance(oType)
oType.InvokeMember("Language",?System.Reflection.BindingFlags.SetProperty?,?Nothing,?o,New?Object(){?"vbscript"})
Return?oType.InvokeMember("Eval",?System.Reflection.BindingFlags.InvokeMethod,?Nothing,?o,?New?Object(){Expressions}).ToString()
End?Function
Eval 在VB中使用,剛找到的_vb吧_百度貼吧
Dim str1 As String = "112113114111"
Dim str2 As String = "11"
Dim count As Integer = 0
For i As Integer = 0 To str1.Length - 1
Dim f As Integer = str1.IndexOf(str2, i)
If f -1 Then
MsgBox("str2出現(xiàn)在str1的" f "個(gè)字符位置")
i = f
count += 1
End If
Next
MsgBox("統(tǒng)計(jì)出str1中共有" count "個(gè)str2!")
使用一個(gè)單重的循環(huán)掃描這個(gè)字符串中的所有字符,對(duì)每一個(gè)字符的出現(xiàn)次數(shù)進(jìn)行統(tǒng)計(jì),最后輸出每個(gè)字符的出現(xiàn)次數(shù)。
Private Sub Command1_Click()
s = InputBox("請(qǐng)輸入一個(gè)英文字符串:")
Dim a(128) As Integer
For i = 1 To Len(s)
t = Asc(Mid(s, i, 1))
a(t) = a(t) + 1
Next i
For i = 1 To 127
If a(i) 0 Then Print Chr(i); ":"; a(i)
Next i
End Sub
Split好像只能計(jì)算單個(gè)字符的吧,樓主要的是字符串在字符串中的個(gè)數(shù),需要自己寫函數(shù)的,用指針定位,然后循環(huán)查找!