1.split(包含子字符串和分隔符的字符串表達式 ,[分隔符],[要返回的子字符串數],[數字值表示判別子字符串時使用的比較方式]),[]部分為可選部分。該函數返回一個以零為下標的一維數組,它包含指定數目的子字符串。
例:
dim xx as variant
xx=split("hello world"," ")'將hello world 分隔為hello和world
text1.text= xx(0) '返回hello
text2.text=xx(1) '返回world
2.ubound(數組名),該函數返回一個 long 型數據,其值為指定的數組維可用的最大下標
lbound(數組名),返回一個 long 型數據,其值為指定數組維可用的最小下標。
例:
dim xx as variant
xx=split("hello world"," ")
text1.text=ubound(xx) '返回1
text2.text=lbound(xx) ‘返回0
3.instr([start, ]string1, string2),該函數返回 variant (long),指定一字符串(string2)在另一字符串中(string1)最先出現的位置,如果沒有找到返回0。[start,]為可選參數,表示搜索的開始位置。
例:
dim xx as string
xx="hello world"
text1.text=instr(xx,"o") '返回5
text2.text=instr(6,xx,"o") '返回8,從第6個字符開始查找
4.mid(string, start[, length]),返回variant (string),其中包含字符串(string)中指定長度[,length]的字符,start為開始位置。其中的[,length]為可選參數不指定長度,則返回start后的所有字符。
例:
dim xx as sting
xx="hello world"
text1.text=mid(xx,1,5)'返回hello
text2.text=mid(xx,1) '返回hello world