Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Split


  • From: javascript@xxxxxxxxxx (Carl Adler)
  • Subject: [Javascript] Split
  • Date: Wed, 11 Dec 2002 13:19:42 -0500

> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--MS_Mac_OE_3122457582_5522083_MIME_Part
Content-type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit

I just tested it and \/ works and // does not work.
Carl

From: Peter Brunone <peter_brunone@xxxxxxxxx>
Reply-To: javascript@xxxxxxxxxx
Date: Wed, 11 Dec 2002 09:08:50 -0800 (PST)
To: javascript@xxxxxxxxxx
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@xxxxxxxxxxxxx> 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@xxxxxxxxxx
> Date: Tue, 10 Dec 2002 17:40:46 -0600
> To: 
> Subject: RE: [Javascript] Split
> 
> 
> var t=txt.split("\\")
> 
> |-----Original Message-----
> |From: javascript-admin@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx]On
> |Behalf Of Andrew Gibson
> |Sent: Wednesday, December 11, 2002 4:23 AM
> |To: javascript@xxxxxxxxxx
> |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@xxxxxxxxxx
> |https://lists.LaTech.edu/mailman/listinfo/javascript
> |
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 

_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx
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>



--MS_Mac_OE_3122457582_5522083_MIME_Part
Content-type: text/html; charset="US-ASCII"
Content-transfer-encoding: quoted-printable

<HTML>
<HEAD>
<TITLE>Re: [Javascript] Split</TITLE>
</HEAD>
<BODY>
I just tested it and \/ works and // does not work.<BR>
Carl<BR>
<BLOCKQUOTE><BR>
<B>From: </B>Peter Brunone &lt;peter_brunone@xxxxxxxxx&gt;<BR>
<B>Reply-To: </B>javascript@xxxxxxxxxx<BR>
<B>Date: </B>Wed, 11 Dec 2002 09:08:50 -0800 (PST)<BR>
<B>To: </B>javascript@xxxxxxxxxx<BR>
<B>Subject: </B>Re: [Javascript] Split<BR>
<BR>
</BLOCKQUOTE><BR>
<BLOCKQUOTE><BR>
But he wants to split based on \, not on /. &nbsp;<BR>
<BR>
txt.split(&quot;\\&quot;) escapes the second \ character, just as <BR>
<BR>
txt.split(&quot;\&quot;&quot;) escapes the &quot; character so you can spli=
t on it... not that you would, but there it is. <BR>
<BR>
As for working in different browsers... ah, that's the joy of web developme=
nt. <BR>
<BR>
-Peter <BR>
<BR>
 <B><I>Carl Adler &lt;carl@xxxxxxxxxxxxx&gt;</I></B> wrote: <BR>
<BLOCKQUOTE>Actually var t=3Dtxt.split(&quot;\&quot;)<BR>
&gt; |works for me using Netscape 4.7 and IE 5.1 on the Mac and IE 5.5 on W=
indows<BR>
ME. If &quot;\&quot; was a problem I think that you would use &quot;\/&quot=
; not &quot;//&quot;<BR>
Carl<BR>
<BR>
&gt; From: &quot;Peter Brunone&quot; <BR>
&gt; Organization: Your Name Here<BR>
&gt; Reply-To: javascript@xxxxxxxxxx<BR>
&gt; Date: Tue, 10 Dec 2002 17:40:46 -0600<BR>
&gt; To: <BR>
&gt; Subject: RE: [Javascript] Split<BR>
&gt; <BR>
&gt; <BR>
&gt; var t=3Dtxt.split(&quot;\\&quot;)<BR>
&gt; <BR>
&gt; |-----Original Message-----<BR>
&gt; |From: javascript-admin@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx=
]On<BR>
&gt; |Behalf Of Andrew Gibson<BR>
&gt; |Sent: Wednesday, December 11, 2002 4:23 AM<BR>
&gt; |To: javascript@xxxxxxxxxx<BR>
&gt; |Subject: [Javascript] Split<BR>
&gt; |<BR>
&gt; |<BR>
&gt; |I'm trying to use split to separate out a file name from the complete=
<BR>
&gt; |string.<BR>
&gt; |<BR>
&gt; |from<BR>
&gt; |<BR>
&gt; | var txt=3D&quot;C:\Copy\new.html&quot;<BR>
&gt; |<BR>
&gt; | I want to get &quot;new.html&quot;<BR>
&gt; |<BR>
&gt; |Whenever I try to use &quot;\&quot; I get a Unterminated String varia=
ble error<BR>
&gt; | eg var t=3Dtxt.split(&quot;\&quot;)<BR>
&gt; |<BR>
&gt; |Obviously the problem is in trying to use the &quot;\&quot; character=
 which is an<BR>
&gt; |escape char for JScript I beleive. But how can I solve my problem?<BR=
>
&gt; |<BR>
&gt; |Andrew<BR>
&gt; |<BR>
&gt; |<BR>
&gt; |_______________________________________________<BR>
&gt; |Javascript mailing list<BR>
&gt; |Javascript@xxxxxxxxxx<BR>
&gt; |https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
&gt; |<BR>
&gt; _______________________________________________<BR>
&gt; Javascript mailing list<BR>
&gt; Javascript@xxxxxxxxxx<BR>
&gt; https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
&gt; <BR>
<BR>
_______________________________________________<BR>
Javascript mailing list<BR>
Javascript@xxxxxxxxxx<BR>
https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
<BR>
<BR>
</BLOCKQUOTE><BR>
<BR>
<HR ALIGN=3DCENTER SIZE=3D"1" WIDTH=3D"100%"><BR>
Do you Yahoo!?<BR>
Yahoo! Mail Plus &lt;http://rd.yahoo.com/mail/mailsig/*http://mailplus.yaho=
o.com&gt; &nbsp;- Powerful. Affordable. Sign up now &lt;http://rd.yahoo.com/=
mail/mailsig/*http://mailplus.yahoo.com&gt; <BR>
</BLOCKQUOTE><BR>
</BODY>
</HTML>


--MS_Mac_OE_3122457582_5522083_MIME_Part--