Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15664
| From | Stefan Weiss <krewecherl@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: String Processing in JavaScript |
| Date | 2012-09-03 19:29 +0200 |
| Organization | albasani.net |
| Message-ID | <k22pe2$cmk$1@news.albasani.net> (permalink) |
| References | <rgf248la5ap1dusauc9ek39jasff47mht4@4ax.com> |
On 2012-09-01 00:56, Gene Wirchenko wrote: > I will be passing back long result strings to my Web pages. These > strings have to be parsed into error codes and form field contents. > What I am working with looks like > <fieldname>:<value length>:<value>\n > The value is encodeURIComponent()ed. From your other posts, it appears that you're in control of both backend and client code. If that's the case, you may want to consider one of the many standardized data transfer formats. JSON would be the obvious choice, as it's trivially easy to use for a JavaScript client, and it's well supported in every major server-side language. Others possible choices include XML (also well supported by JS) or YAML, etc. The major advantages over homebrew data formats are 1) less code, because native support already exists 2) no worrying about separators and "safe" characters 3) they support hierarchical/structured data 4) they're standardized, so you'll still know how they work 2 years after you finish writing this part. As will other people who may inherit your code. 5) they're standardized, which means your data is now accessible to other tools (like debuggers, syntax checkers, and unit test frameworks) - stefan
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-08-31 15:56 -0700
Re: String Processing in JavaScript Mike Winter <usenet@michael-winter.me.invalid> - 2012-09-01 02:30 +0100
Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-02 17:56 -0700
Re: String Processing in JavaScript Jim T. <x@y.z> - 2012-08-31 22:30 -0400
Re: String Processing in JavaScript "Mel Smith" <med_cutout_syntel@aol.com> - 2012-08-31 21:47 -0600
Re: String Processing in JavaScript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-09-01 08:51 +0000
Re: String Processing in JavaScript "Mel Smith" <med_cutout_syntel@aol.com> - 2012-09-01 08:38 -0600
Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-02 18:04 -0700
Re: String Processing in JavaScript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-09-03 16:30 +0000
Re: String Processing in JavaScript Mike Winter <usenet@michael-winter.me.invalid> - 2012-09-03 21:23 +0100
Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-03 14:26 -0700
Re: String Processing in JavaScript Stefan Weiss <krewecherl@gmail.com> - 2012-09-03 19:29 +0200
Re: String Processing in JavaScript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-03 21:45 +0200
Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-03 14:27 -0700
Re: String Processing in JavaScript Stefan Weiss <krewecherl@gmail.com> - 2012-09-04 00:48 +0200
Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-03 17:20 -0700
Re: String Processing in JavaScript Tim Streater <timstreater@greenbee.net> - 2012-09-04 10:06 +0100
Re: String Processing in JavaScript Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-09-04 20:02 +1000
Re: String Processing in JavaScript Gene Wirchenko <genew@ocis.net> - 2012-09-04 08:47 -0700
csiph-web