Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Breaking apart strings

Status
Not open for further replies.

tycaine

Programmer
Feb 8, 2003
29
CA
As the subject suggests I need to break apart strings, strings that may be composed as follows:

"one|two|three"

I need to break them apart at the "|" and drop the three (in this case) into an array so that:

Array(0)="one"
Array(1)="two"
Array(2)="three"

And so on. Now, the big thing is that the strings could contain any number of 'items', so one could be "one|two|three" while another could be "one|two|three|four|five|six" and so on...

Is this possible? I've done something similar in JSP but now need to do it in ASP, and I'm at a loss, can anyone help me?

Thanks in advance!

T.C.
 
Code:
Dim aryMyStrings
aryMyStrings = Split(strYourString)
 
Oops. Make that:
Code:
Dim aryMyStrings
aryMyStrings = Split(strYourString, "|")
 
Yes, thank you for the confirmation, I was this close to figuring it out for myself, but your note helped confirm things, thank you!!

Code:
stringList = "one|two|three"
arrayName = split(stringList,"|")
For i = 0 to ubound(arrayName)
	Response.write(arrayName(i))
	Response.write("<BR>")
Next

Output:
Code:
one<BR>two<BR>three

Which shows as:

one
two
three

Again, thank you!! :)


T.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top