开发者

VB Script split issue

I use the split function of in VBScript to split the string. Below is the code am using.

Dim inputText
DIM resultArray 

inputText = "abc; def; ""xyz;123"""
resultArray = Split(inputText, "; ")

For i = 0 To UBound(resultArray)
    resultArray(i) = Replace(resultArray(i), """", "")          
    resultArray(i) = Replace(resultArray(i), ";", "")
    IF i = UBound(resultArray) THEN
        Response.Write resultArray(i)
    ELSE
        Response.Write resultArray(i) & "; "
    END IF
Next

If i remove the space after ; in split function it will also split "xyz:123" which i don't want to be.

Either i gave space after ; in split function (Line # 4) or not it shouldn't split t开发者_如何学Gohe "xyz:123" which comes in double quotes.

Any suggestion how i can achieve this ?

Thanks in advance.


That suspiciously looks like a csv-file. You could try using ADO for this. Microsoft has a fairly extensive (and very useful) article on this: http://msdn.microsoft.com/en-us/library/ms974559.aspx

Since they describe exactly your problem, I think that just might be your solution. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜