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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

split() 1

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
US
I feel kinda silly asking this question, but here goes...

the default split() function "split by" value is a space " ". How can you set it so it'll split a value to seperate every character in a string?

Example...

string = "Hello There!"

Desired result...

string(0) = "H"
string(1) = "e"
string(2) = "l"
string(3) = "l"
string(4) = "o"
string(5) = " "
string(6) = "T"
string(7) = "h"
string(8) = "e"
string(9) = "r"
string(10) = "e"
string(11) = "!"

Thanks in advance. -Ovatvvon :-Q
 
I don't think you can, the function expects a string as the second argument to use as the delimiter, otherwise it won't work.
One way to do this, however, would be to use the mid function in a loop:
Code:
For i = 1 to len(myStr)
   myArray(i) = mid(myStr,i,1)
Next

If it wasn't 1am here and I didn't have a flight in the morning I'd do some research on a better way to do this, but the above method should work.
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
FAQ FAQ20-2863
= new Forums.Posting.General.GettingAnswers()
 
Ofcourse...I'm an idiot!
Thanks! :) -Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top