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 (Ben Joyce)
  • Subject: [Javascript] Split
  • Date: Wed, 11 Dec 2002 18:24:20 -0000

This is a multi-part message in MIME format.

------=_NextPart_000_0002_01C2A142.877CC610
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

\o/ :)

-----Original Message-----
From: javascript-admin@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx]
On Behalf Of Carl Adler
Sent: 11 December 2002 18:20
To: javascript@xxxxxxxxxx
Subject: Re: [Javascript] Split


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> 




------=_NextPart_000_0002_01C2A142.877CC610
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D839462318-11122002><FONT face=3D"Courier New" =
color=3D#0000ff=20
size=3D2>\o/ :)</FONT></SPAN></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
  face=3DTahoma size=3D2>-----Original Message-----<BR><B>From:</B>=20
  javascript-admin@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx] <B>On =
Behalf=20
  Of </B>Carl Adler<BR><B>Sent:</B> 11 December 2002 18:20<BR><B>To:</B> =

  javascript@xxxxxxxxxx<BR><B>Subject:</B> Re: [Javascript]=20
  Split<BR><BR></FONT></DIV>I just tested it and \/ works and // does =
not=20
  work.<BR>Carl<BR>
  <BLOCKQUOTE><BR><B>From: </B>Peter Brunone=20
    &lt;peter_brunone@xxxxxxxxx&gt;<BR><B>Reply-To:=20
    </B>javascript@xxxxxxxxxx<BR><B>Date: </B>Wed, 11 Dec 2002 09:08:50 =
-0800=20
    (PST)<BR><B>To: </B>javascript@xxxxxxxxxx<BR><B>Subject: </B>Re:=20
    [Javascript] Split<BR><BR></BLOCKQUOTE><BR>
  <BLOCKQUOTE><BR>But he wants to split based on \, not on /.=20
    &nbsp;<BR><BR>txt.split("\\") escapes the second \ character, just =
as=20
    <BR><BR>txt.split("\"") escapes the " character so you can split on =
it...=20
    not that you would, but there it is. <BR><BR>As for working in =
different=20
    browsers... ah, that's the joy of web development. <BR><BR>-Peter=20
    <BR><BR><B><I>Carl Adler &lt;carl@xxxxxxxxxxxxx&gt;</I></B> wrote: =
<BR>
    <BLOCKQUOTE>Actually var t=3Dtxt.split("\")<BR>&gt; |works for me =
using=20
      Netscape 4.7 and IE 5.1 on the Mac and IE 5.5 on Windows<BR>ME. If =
"\" was=20
      a problem I think that you would use "\/" not =
"//"<BR>Carl<BR><BR>&gt;=20
      From: "Peter Brunone" <BR>&gt; Organization: Your Name =
Here<BR>&gt;=20
      Reply-To: javascript@xxxxxxxxxx<BR>&gt; Date: Tue, 10 Dec 2002 =
17:40:46=20
      -0600<BR>&gt; To: <BR>&gt; Subject: RE: [Javascript] Split<BR>&gt; =

      <BR>&gt; <BR>&gt; var t=3Dtxt.split("\\")<BR>&gt; <BR>&gt; =
|-----Original=20
      Message-----<BR>&gt; |From: javascript-admin@xxxxxxxxxx=20
      [mailto:javascript-admin@xxxxxxxxxx]On<BR>&gt; |Behalf Of Andrew=20
      Gibson<BR>&gt; |Sent: Wednesday, December 11, 2002 4:23 AM<BR>&gt; =
|To:=20
      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=20
      from the complete<BR>&gt; |string.<BR>&gt; |<BR>&gt; |from<BR>&gt; =

      |<BR>&gt; | var txt=3D"C:\Copy\new.html"<BR>&gt; |<BR>&gt; | I =
want to get=20
      "new.html"<BR>&gt; |<BR>&gt; |Whenever I try to use "\" I get a=20
      Unterminated String variable error<BR>&gt; | eg var=20
      t=3Dtxt.split("\")<BR>&gt; |<BR>&gt; |Obviously the problem is in =
trying to=20
      use the "\" character which is an<BR>&gt; |escape char for JScript =
I=20
      beleive. But how can I solve my problem?<BR>&gt; |<BR>&gt; =
|Andrew<BR>&gt;=20
      |<BR>&gt; |<BR>&gt;=20
      |_______________________________________________<BR>&gt; =
|Javascript=20
      mailing list<BR>&gt; |Javascript@xxxxxxxxxx<BR>&gt;=20
      |https://lists.LaTech.edu/mailman/listinfo/javascript<BR>&gt; =
|<BR>&gt;=20
      _______________________________________________<BR>&gt; Javascript =
mailing=20
      list<BR>&gt; Javascript@xxxxxxxxxx<BR>&gt;=20
      https://lists.LaTech.edu/mailman/listinfo/javascript<BR>&gt;=20
      =
<BR><BR>_______________________________________________<BR>Javascript=20
      mailing=20
      =
list<BR>Javascript@xxxxxxxxxx<BR>https://lists.LaTech.edu/mailman/listinf=
o/javascript<BR><BR><BR></BLOCKQUOTE><BR><BR>
    <HR align=3Dcenter width=3D"100%" SIZE=3D1>
    <BR>Do you Yahoo!?<BR>Yahoo! Mail Plus=20
    &lt;http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com&gt; =
&nbsp;-=20
    Powerful. Affordable. Sign up now=20
    &lt;http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com&gt;=20
  <BR></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0002_01C2A142.877CC610--