阿瑟 發表
如果您有使用過多選項(如勾選方塊)的表單與ASP的運用的話. 你會發現表單會將多個選項的值用逗號分隔傳至目的ASP. 這隻程式會告訴您如何把這串綜合字串分解成陣列.
語法範例:
inputstring = "hello,hey,hi" '設定目標字串 sepsymbol = "," '設定分隔符號 x=0 while len(inputstring)<>Empty t=InStrRev(inputstring,sepsymbol) if t=0 then ReDim Preserve outputstring(x) outputstring(x)=trim(inputstring) inputstring=Empty else ReDim Preserve outputstring(x) outputstring(x)=trim(right(inputstring,len(inputstring)-t)) inputstring=replace(left(inputstring,t-1),outputstring(x),Empty) end if x=x+1 Wend |