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 Chris Miller 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.

hmcheung

Programmer
Oct 13, 2000
66
HK
Is there any functions in foxpro 6.0 equivilant to split() in asp? It chops a string in pieces according to a delimiter and put these pieces into an array. e.g.

MyArray = split("a#b#123", "#")

will give

MyArray(0) = 'a'
MyArray(1) = 'b'
MyArray(2) = '123'

thanks! Please visit my WebCam!!
 
Funny, I'd think there would be, but can't find a single function that does exactly that either. But I'm not experienced enough in VFP to know all the available functions. OTOH (on the other hand), you can use the AT() function to much the same thing pretty easily. You just need to set up a loop and put the substrings between the positions AT() returns into the array. -- Dave
 
Hi!

Try following approach:

alines(MyArray,chrtran("a#b#123", "#", chr(13)))

You will get all character values in the array elements, however.



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Ahhh! I thought there might be a way to change the search character in alines, but I didn't realize you can do it on the fly, as it were. I was figuring you'd have to do something to change the system and then change it back when you were done and that seemed more trouble than it was worth. Anyway, glad to know it can be done so easily; I have a use for the technique. -- Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top