Computing.Net > Forums > Programming > VB and string delimiters

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

VB and string delimiters

Reply to Message Icon

Original Message
Name: Dr. Nick
Date: April 14, 2003 at 14:02:42 Pacific
Subject: VB and string delimiters
OS: WinXP Pro b2600 SP1
CPU/Ram: P4 2.0Ghz & 1024MB pc133
Comment:

I'm having a problem with VB and strings. I'm using ASP and am trying to set a session variable to hold a url. Here's the code:

Session("HELP_URL") = "<A HREF='javascript:popuphelp('loggedout');'><FONT SIZE=2> Help</FONT></A>"

The link should call a javascript fuction with the word "loggedout" passed to it.  The problem is that as the script is above, the (') next to loggedout ends the javascript string instead of starting a new string containing 'loggedout'. If I use a (") it ends the VB string.

Any ideas?  Thanks.


Report Offensive Message For Removal


Response Number 1
Name: Dr. Nick
Date: April 14, 2003 at 14:03:28 Pacific
Reply: (edit)

Oops. Sorry about the formatting!


Report Offensive Follow Up For Removal

Response Number 2
Name: borelli34
Date: April 14, 2003 at 22:59:55 Pacific
Reply: (edit)

I may be wrong but I believe in this case you would use two single quotes together at that point to tell the compiler/interpreter that you actually DO want the single quote their. Give it a try. The worst that can happen is nothing changes.

borelli34


Report Offensive Follow Up For Removal

Response Number 3
Name: Dr. Nick
Date: April 15, 2003 at 07:23:40 Pacific
Reply: (edit)

Thanks for the suggestion. You are right, actually. To tell vb that you really want a quote you either tell it '' for a ' and "" for a ". You can also use the ASCII value for a (") by typing char(34), which some people think is easier to read than

Response.Write "Bob said ""Hello."""

Response.Write "Bob said" & char(32) & "Hello." & char(32)

Anyway, thanks again.


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software