Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with string parsing into array
Message
From
07/03/2017 11:49:50
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
07/03/2017 08:53:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01647020
Message ID:
01648832
Views:
54
>With all my respect, I would disagree that GetWordnum() or alines() would be a solution to this problem.
>
>@Jaime
>You have JSON, use JSON parsing. Getwordnum() is dangerous. If you mean your JSON would always be like this, then you don't even need GetWordnum(), just hardcode the result. If you would try GetWordNum() anyway, then at least use the safer Strextract() - but it is JSON, go with JSON parsing.

I concur. This is the old problem of packing data containing text in a text format - and then just fishing for delimiters blindly is going to break things when the delimiter is found inside the text. This is the primary stumbling block in such cases, be it encoding html inside html, or having to double quotes inside quotes (in csv) or apostrophes within apostrophes (in TSQL), or various control characters (like \n, \m, \t etc in various situations). The parsers are written with the sole intent to extract data (i.e. user readable text, numbers etc) from formatted text. Trying to write a roughshod parser is not just a waste of time, it's a waste of future time and nerves.

Trying to break it when encountering ", " - well, I can't imagine any piece of, even moderately regular, text which may contain that, right?

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform