Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: string comparison fails? - Image1.jpg (0/1) Date: Sat, 17 Oct 2015 14:59:10 +0200 Organization: PointedEars Software (PES) Lines: 45 Message-ID: <4114734.0R2ZEXP6cX@PointedEars.de> References: <08642bl9537lanf90ghcng1hefvuejcl20@4ax.com> <87io65pzlw.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1445086750 15880 eJwNxckVADAEBcCWCF8ox/L0X0Iyl4EYW181mGKx2T1/cISmV4r4CISI/MbOQfph1BapVyweG4EQ1Q== (17 Oct 2015 12:59:10 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 17 Oct 2015 12:59:10 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwQkBwDAIA0BLlD9y2gz8S9hdWJ5keUZ6bCym5vKJXmrl617GUGFNyFGIX3/1pGhWipxZB74PjA5x/QFfvxVI Cancel-Lock: sha1:VI88I3qROWtCyxOu8ExxGlF4H+U= X-NNTP-Posting-Host: eJwNxsEBwCAIA8CVEEjAcSrC/iPYex2MixVO0DEYjYDGWT6lHSnNfcv4bYFMddZN65q/I4JzHxi0Ecs= Mail-Copies-To: usenet@PointedEars.de Xref: csiph.com comp.lang.javascript:28833 Ben Bacarisse wrote: > joe writes: >> var apu2=all.split(">"); Given your input, that is a very bad idea. You should respond with either of plain text, JSON, or XML, and use appropriate parsers instead. >> var ii=apu2.length; >> for (i=0;i> { >> allte=apu2[i].substring(0,4); >> if (allte=="TTY") > > There's a big clue here. How can a 4 character string ever equal "TTY"? When it is only three characters long: "TTY".substring(0, 4) == "TTY". That was easy. > >> The local file I'me reading into "all" and then splitting into array at >> ">" is: >> >> […] >> >> TTY:helpc.htm >> >> > > Almost every ">" is follwoed by a newline character. I'm guessing that > what looks to you like "TTY" is, in fact "\nTTY" (and hence 4 characters > long). If they split this input on “>”, then there is an array element "\nTTY:helpc.htm\n | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.