所以我对VBScript更新,并且正在努力取一个字符串并删除/拆分它。我目前有:
id= mid(storeline,id,instr(id,storeline, ";",1))
我基本上想要在&#34 ;;"之后删除任何代码。
例如:ID:12049302; Height = 20;
我目前让它返回所有内容。任何帮助都非常棒。
答案 0 :(得分:2)
您可以使用Split()
根据;
分隔符值来缩小字符串,如此;
Dim storeline: storeline = "ID:12049302; Height = 20;"
Dim data: data = Split(storeline, ";")
Dim entry
If IsArray(data) Then
'Return just the first entry
WScript.Echo "Result is " & Trim(data(0) & "")
'Use a loop to iterate through the Array
For Each entry In data
entry = Trim(entry & "")
WScript.Echo entry
Next
End If
输出:
Result is ID:12049302
ID:12049302
Height = 20
答案 1 :(得分:1)
假设storeline = "ID:12049302; Height = 20;"
然后
myArray = Split(storeline, ";")
id = myArray(0) ' will contain "ID:12049302"