Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing comma delimited string
Message
From
24/11/2001 07:01:06
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
23/11/2001 16:23:30
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00585228
Message ID:
00585342
Views:
29
>>I need to parse a comma delimited string in VFP 5.0. Since I can't use ALINES() in 5.0, what would be the best way to parse this string.
>>
>>"111111,222,333"
>
>Hi, Ron
>
>Something like ?...
>
lcStr = "111111,222,333"
>lcParsed = STRTRAN(lcStr,",",CHR(13))
>FOR lnLine = 1 TO MEMLINES(lcParsed)
>	? MLINE(lcParsed,lnLine)
>ENDFOR
>
>
>bye

If you use memlines() and mline(), in a loop, also be sure to take a look at _mline, for efficiency. This helps VFP go directly to the place you left off, instead of counting commas from the beginning of the string every time.

The documentation on mline() or memlines() includes a sample.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform