[Javascript] If a string contains many ' and " and \"

Chris Tifer christ at saeweb.com
Wed Jul 9 07:38:30 CDT 2003


Right - you couldn't just add a single \ becuase the first \ you
add was for the "\" before the quote.

You're really escaping 2 characters here. The \ and the "

So look at it like:

\\ and \"

Which put together is:

\\\"

Chris Tifer


----- Original Message -----
From: "Andrew Gibson" <andyg at ihug.co.nz>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Tuesday, July 08, 2003 7:04 PM
Subject: Re: [Javascript] If a string contains many ' and " and \"


> As an aside I was stuck with a similar problem, how to deal with the
> following string
>
> str="Try the "following" folder:  d:\"this folder  "
>
> I can replace "  with \"  for the normal "  within the string but to save
to
> d:\"  I couldn't just add a \ to make it d:\\"  it would only work when I
> made it d:\\\"
>
> Andrew Gibson
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list