Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2004, 12:04 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Double Quotes and Single Quotes Problem

Hi All,

Please help. :-)

I am grabing string of texts from a database and putting them into a JavaScript Array. These string of texts contain single and double quotes(Example: He said "They'll sing "Jingle Bell""). DON'T worry about the grammatical syntax right now; this is just an example.

Here is my problem. When I replace all the double quotes with single quotes(in my database records), I will have no problem, when I run my JavaScript. But if I leave the double quotes in, my array will NOT work.

Is there anyway I can solve this problem? I HAVE to have my double quotes!

Thank you.

Leon

 
Old May 26th, 2004, 12:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Leon,

You can replace all the occurances of double quotes to "something else", that does not hinder you array manipulations, and then when showing them on the page, replace those "something else" to double quotes back.

Change " to $ or @ (whichever u prefer that does not hinder you array manipulations)
Change ' to ! or ~

Do array manipulations

Change $/@ back to "
Change !/~ back to '

NOTE: See to that you dont have $/@/!/~ within you string texts, so that they dont get replaced to "/' post manipulations. You got to decide which character to go for replacing the quotes.

Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old May 26th, 2004, 12:29 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

Have you tried this?

MyQuote = "He said ""They'll sing ""Jingle Bell"""""

 
Old May 26th, 2004, 12:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

DaveGerard,

I assume Leon is having problem in manipulating with double quotes in arrays using javascript. I think the one you are referring to is used with VBScript.

_________________________
-Vijay G
Strive for Perfection
 
Old May 26th, 2004, 12:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

MyQuote = "He said ""They'll sing ""Jingle Bell""""" will work in ASP too, although I see the problem that you are having. In JavaScript, you can have single-quotes or double-quotes by using an escape sequence, such as \" or \'. That will write a double or single quote to the string for javascript.

Brian
 
Old May 26th, 2004, 02:24 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you guys for the quick reply and solution! My codes works now! There are so much more for me to learn. Until next time....

Thanks again!!! :-)

Leon

 
Old May 26th, 2004, 11:10 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

So what was the solution?

 
Old May 27th, 2004, 01:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hope he should have gone with Brian's suggestions.

_________________________
-Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help! i hate...double and single quotes... keita Classic ASP Basics 3 March 28th, 2007 11:12 AM
Please explain single and double quotes rsgracey BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 4 June 8th, 2006 07:20 PM
displaying single quotes and double quotes ren_123 Classic ASP Databases 2 February 22nd, 2006 02:17 PM
Storing single and double quotes in text roniestein Access 4 December 30th, 2003 05:09 PM
Getting single and double quotes into DB hoffmann Classic ASP Databases 9 December 4th, 2003 12:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.