3

I'm trying to split a string in classic ASP by two parameters/patterns

As an example, I'm trying to do something like

str = "1,2,3,4|5|6.7.8"
arr = Split(str, "," , "|" )
'arr = [ 1 , 2 , 3 , 4 , 5 , 6.7.8 ]

Is there a way to do that besides writing my own split function? (iterating over the entire string, comparing with patterns...)

4

1 に答える 1

4

最初に値の1つを置き換えてから、それを分割することができます。たとえば、コンマをパイプに置き換えてから、パイプで分割します。

arr = Split(Replace(str, ", ", "|"), "|" ) 
于 2012-07-19T17:31:02.490 に答える