Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28833
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: string comparison fails? - Image1.jpg (0/1) |
| Date | 2015-10-17 14:59 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <4114734.0R2ZEXP6cX@PointedEars.de> (permalink) |
| References | <08642bl9537lanf90ghcng1hefvuejcl20@4ax.com> <87io65pzlw.fsf@bsb.me.uk> |
Ben Bacarisse wrote:
> joe <mt@invalid.com> 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<ii;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.
> <snip>
>> The local file I'me reading into "all" and then splitting into array at
>> ">" is:
>>
>> […]
>> <BODY>
>> TTY:helpc.htm
>> </body>
>> </html>
>
> 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</body", where "\n" can be either this (Unices)
or one of "\r\n" (Windows) or "\r" (Mac OS < 10).
They should use a debugger next time; see the FAQ.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
string comparison fails? - Image1.jpg (0/1) joe <mt@invalid.com> - 2015-10-17 13:00 +0300
Re: string comparison fails? - Image1.jpg (0/1) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-17 11:18 +0100
Re: string comparison fails? - Image1.jpg (0/1) joe <mt@invalid.com> - 2015-10-17 13:57 +0300
Re: string comparison fails? - Image1.jpg (0/1) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-17 14:59 +0200
Re: string comparison fails? - Image1.jpg (0/1) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-17 14:37 +0100
Re: string comparison fails? - Image1.jpg (0/1) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-17 16:11 +0200
Re: string comparison fails? - Image1.jpg (0/1) "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-10-17 12:21 +0200
Re: string comparison fails? - Image1.jpg (0/1) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-10-17 12:28 +0200
csiph-web