Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with string parsing into array
Message
De
07/03/2017 11:49:50
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
07/03/2017 08:53:07
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Database:
Visual FoxPro
Divers
Thread ID:
01647020
Message ID:
01648832
Vues:
55
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform