Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15651
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: String Processing in JavaScript |
| Date | 2012-08-31 21:47 -0600 |
| Message-ID | <aadeqvFtm3U1@mid.individual.net> (permalink) |
| References | <rgf248la5ap1dusauc9ek39jasff47mht4@4ax.com> <6os248lttein62omugahl5avvlpb18o8o2@4ax.com> |
Jim said:
> Perhaps String.split() ?
Gene:
Agree 1000% with Jim !
I send 2000+ chars strings to/from my server, and my server .exe builds
a 'splittable' string back to the browser.
Your structure is ideal for a 'double' split. The 1st split would bust
up the string at the 'newline' char creating an array of n-rows of chars
Then, during the parse of each row, you can break that row of this main
array into another 1-d array of three values by 'splitting' at the colon
char.
I found this to be a nifty way of parsing my incoming strings.
Because your main split is at 2-char '\n' set, I guess you'd have to use
a regex expression to make the split. Why not just use the 'not' charater
('~') as the line terminator ?
btw, because I know *my* incoming data, I use other chars for delimiters
that would never appear in my incoming string (e.g., ~ ^ ! etc)
So, if you *know always* the set of chars input, then others can be used
as delimiters.
Good Luck !
-Mel Smith
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