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 a string into words 1

Status
Not open for further replies.

alvechurchdata

Programmer
Nov 8, 2003
1,737
GB
There's a Fox function to split a string into words and I've forgotten what it is. I know I can work around it with ALINES() and a memo field but can anyone help me with an easier way?

Geoff Franklin
 
FWIW, ALINES() is a lot faster. GetWordNum() is great if you just need to pull one or two words out, but if you need all the words split, use ALINES().

Here's what I wrote about the speed issue a while back:

"These two functions are really designed more for extracting specific words than for parsing whole strings, though. They’re much slower than ALINES() and even slower than manually parsing with AT() and SUBSTR(). Like manual parsing, the slowdown is much more than linear. In my tests, parsing a 160-character string into words 10 times with these functions took less .01 seconds, but for a string of more than 80,000 characters, 10 passes took more than 100 seconds. By comparison, using ALINES() with the optional parse characters, the time went from about .001 seconds for 160 characters to .08 seconds for the 80,000+-character string."

Tamar
 
Thanks Tamar but it's a one-shot process so I can afford to waste milliseconds. I'm passing a comma-separated string of SQL field names into a reporting function and I need to get at the individual names.

Geoff Franklin
 
Okay, no big deal.

I'd definitely use ALINES() for something like that because all the parsing's done in one line:

nFieldCount = ALINES(aFieldList, m.cFieldList, ",")

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top