Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 26th, 2004, 12:04 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old May 26th, 2004, 12:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #3 (permalink)  
Old May 26th, 2004, 12:29 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Minneapolis, MN, USA.
Posts: 171
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried this?

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

Reply With Quote
  #4 (permalink)  
Old May 26th, 2004, 12:35 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #5 (permalink)  
Old May 26th, 2004, 12:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
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
Reply With Quote
  #6 (permalink)  
Old May 26th, 2004, 02:24 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , .
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

Reply With Quote
  #7 (permalink)  
Old May 26th, 2004, 11:10 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Minneapolis, MN, USA.
Posts: 171
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So what was the solution?

Reply With Quote
  #8 (permalink)  
Old May 27th, 2004, 01:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hope he should have gone with Brian's suggestions.

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 01:17 PM
Storing single and double quotes in text roniestein Access 4 December 30th, 2003 04:09 PM
Getting single and double quotes into DB hoffmann Classic ASP Databases 9 December 3rd, 2003 11:24 PM



All times are GMT -4. The time now is 01:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.