[Javascript] Split
Carl Adler
carl at carladler.org
Wed Dec 11 12:40:50 CST 2002
Ah yes I now remember on a pc "\" is used for internal URLs instead of "/"
which is what I am used to seeing and thought he was splitting on. I mainly
use a Mac and am so used to seeing "/" in internal URLs I mentally
translated his \. That will teach me to copy and paste. The one time I am
not lazy I pay for it. Sorry about that.
Carl
> From: "Peter Brunone" <peter at brunone.com>
> Reply-To: javascript at LaTech.edu
> Date: Wed, 11 Dec 2002 13:30:36 -0500
> To: <javascript at LaTech.edu>
> Subject: Re: [Javascript] Split
>
>
> Doesn't work in what way? // would split on //, since \ is the character that
> he was trying to find, and it's also the escape character (which is why it
> needs to be escaped by another of itself).
>
> -Peter
>
> ---------- Original Message ----------------------------------
> From: Carl Adler <carl at carladler.org>
> Reply-To: javascript at LaTech.edu
> Date: Wed, 11 Dec 2002 13:19:42 -0500
>
>> I just tested it and \/ works and // does not work.
>> Carl
>>
>> From: Peter Brunone <peter_brunone at yahoo.com>
>> Reply-To: javascript at LaTech.edu
>> Date: Wed, 11 Dec 2002 09:08:50 -0800 (PST)
>> To: javascript at LaTech.edu
>> Subject: Re: [Javascript] Split
>>
>>
>>
>> But he wants to split based on \, not on /.
>>
>> txt.split("\\") escapes the second \ character, just as
>>
>> txt.split("\"") escapes the " character so you can split on it... not that
>> you would, but there it is.
>>
>> As for working in different browsers... ah, that's the joy of web
>> development.
>>
>> -Peter
>>
>> Carl Adler <carl at carladler.org> wrote:
>> Actually var t=txt.split("\")
>>> |works for me using Netscape 4.7 and IE 5.1 on the Mac and IE 5.5 on Windows
>> ME. If "\" was a problem I think that you would use "\/" not "//"
>> Carl
>>
>>> From: "Peter Brunone"
>>> Organization: Your Name Here
>>> Reply-To: javascript at LaTech.edu
>>> Date: Tue, 10 Dec 2002 17:40:46 -0600
>>> To:
>>> Subject: RE: [Javascript] Split
>>>
>>>
>>> var t=txt.split("\\")
>>>
>>> |-----Original Message-----
>>> |From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
>>> |Behalf Of Andrew Gibson
>>> |Sent: Wednesday, December 11, 2002 4:23 AM
>>> |To: javascript at LaTech.edu
>>> |Subject: [Javascript] Split
>>> |
>>> |
>>> |I'm trying to use split to separate out a file name from the complete
>>> |string.
>>> |
>>> |from
>>> |
>>> | var txt="C:\Copy\new.html"
>>> |
>>> | I want to get "new.html"
>>> |
>>> |Whenever I try to use "\" I get a Unterminated String variable error
>>> | eg var t=txt.split("\")
>>> |
>>> |Obviously the problem is in trying to use the "\" character which is an
>>> |escape char for JScript I beleive. But how can I solve my problem?
>>> |
>>> |Andrew
>>> |
>>> |
>>> |_______________________________________________
>>> |Javascript mailing list
>>> |Javascript at LaTech.edu
>>> |https://lists.LaTech.edu/mailman/listinfo/javascript
>>> |
>>> _______________________________________________
>>> Javascript mailing list
>>> Javascript at LaTech.edu
>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>
>>
>>
>>
>>
>>
>> Do you Yahoo!?
>> Yahoo! Mail Plus
>> <http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com> - Powerful.
>> Affordable. Sign up now
>> <http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com>
>>
>>
>>
>>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
More information about the Javascript
mailing list