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

How To Parse Strings in FoxPro?

Status
Not open for further replies.

mccartmd

Programmer
Feb 3, 2003
63
US
Hello,

I have had previous experience with parsing a string with C++, but I am trying to do this now with FoxPro. If I have a text file in my project, how can I take individual lines (and then individual words out of that line) and save them as a record, or a field, in a table; or maybe put them directly into a grid. Are there functions available to do this in FoxPro, or should I go about this a different way? Any help would be greatly appreciated.

Thanks.

Mike
St. Louis
 
Look in the help for CHARACTER FUNCTIONS.

Also:
Transform a Partially Formatted Delimited Text File Into a Standard Delimited File faq184-4275 (has sample data)

Parsing Delimited Text faq184-4326

How to strip all but certain chars from a string faq184-3378

Parse A String With Any Delimiter faq184-2062

Or keyword seach for 'parse' etc.

Brian
 
In VFP 5 + 6 use the FoxTools functions WordNum() and Words() for vFP 7/8's GetWordNum() and GetWordCount().
Code:
set library to (home()+"foxtools.fll")
...
for lnii = 1 to Words(mystring)
 ? WordNum(mystring, lnii)
endfor
Rick
 
mccartmd

If you have prior experience parsing data with C++ and now must do it with VFP, you will soon love VFPs STRING functions. As you can tell by the responses, there are many ways to do it in VFP.

As a matter of fact, a whole library was written for the dot net folks and it can be added to your dot net apps. It's all the VFP string commands - only now they can be included in dot net. You can download that class at It works with C# and VB dotnet.



Jim Osieczonek
Delta Business Group, LLC
 
Thanks for all the helpful responses. It sounds like there are many ways that I can do this.

Thanks again.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top