vb脚本函数问题,那位大哥帮帮忙

来源:百度知道 编辑:UC知道 时间:2024/05/28 15:30:23
读取字符串=和#两个字符之间的数据,有这样的脚本函数吗

xac 09:52:23
比如sclx=AC/DC双路输出#2这个数据我只要“AC/DC双路输出”这个数据可以做到吗

可以追加分

这个过程需要自己写,脚本代码如下,复制代码保存为.vbs的文件,双击运行即可:

dim str,i,startstr,endstr
str="sclx=AC/DC双路输出#2"
for i=1 to len(str)
select case mid(str,i,1)
case "="
startstr=i
case "#"
endstr=i
end select
next
msgbox "您要的字符串是:" & mid(str,startstr+1,endstr-startstr-1)

mid(str$,instr(str$,"=")+1,istr($str,"#")-instr(str$)-1)

当然可以啦,如下
Dim a As String
Dim b As String, c As Integer, d As Integer
a = "sclx=AC/DC双路输出#2"
c = InStr(1, a, "=")
a = Mid(a, c + 1)
d = InStr(1, a, "#")
b = Mid(a, 1, d - 1)
Print b

Private Sub Command0_Click()

Dim strSrc$, iS1$, iS2$, iN1%, iN2%

strSrc = "sclx=AC/DC双路输出#2"
iS1 = "=": iS2 = "#"

iN1 = InStr(1, strSrc, iS1)
If iN1 > 0 Then
iN2 = InStr(iN1, strSrc, iS2)
If iN2 > iN1 Then<