iliaden
iliaden

Reputation: 3889

classic ASP: split by two patterns

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...)

Upvotes: 3

Views: 771

Answers (1)

You can replace one of the values first, then split on it. For example, replace commas with pipes, then split on pipes:

arr = Split(Replace(str, ", ", "|"), "|" ) 

Upvotes: 4

Related Questions