在vbscript中
如何把123/321/343字符串分别截取出来放到
a1,a2,a3三个变量中
---------------------------------------------------------------
1<script language="vbscript">
2<!--
3dim str,ary
4str ="aa/bb/cc"
5ary = split(str,"/")
6
7for i=0 to ubound(ary)
8alert(ary(i))
9
10next
11
12
13//-->
14</script>
---------------------------------------------------------------
给你一个函数
1<script language="vbscript" runat="server">
2'从字符串中分离出一个子字符串
3function splitString(strInput,strSpliter,nMethod)
4'strInput代表原始字符串
5'strSpliter代表分隔符
6'nMethod代表分割方式,0取分隔符左边的子字符串,1取分隔符右边的子字符串
7i=InStr(1,strInput,strSpliter)
8if i=0 then
9splitString=""
10else
11if nMethod=0 then
12splitString=Mid(strInput,1,i-1)
13else
14splitString=Mid(strInput,i+len(strSpliter))
15end if
16end if
17end function
18</script>
调用方法:
1
2str="11/22/33/44"
3dim a(4)
4i=0
5do while not strr=""
6a(i)=splitString(strr,"/",0)
7strr=splitString(strr,"/",1)
8i=i+1
9loop