Path: csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Mel Smith" Newsgroups: comp.lang.javascript Subject: Re: String Processing in JavaScript Date: Fri, 31 Aug 2012 21:47:40 -0600 Lines: 36 Message-ID: References: <6os248lttein62omugahl5avvlpb18o8o2@4ax.com> X-Trace: individual.net mt6g5QTweH3kxoMK6ascnQ2SrUMndWFclZ9NEEw2riGO22gWEFPm6ski3/mCfaQ6Zk Cancel-Lock: sha1:5avxAhIOkInRmibM0sbP3meFLhM= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: csiph.com comp.lang.javascript:15651 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