Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do nested quotes: " "Some string" " ?

Status
Not open for further replies.

ranshe

Programmer
Oct 5, 2004
27
0
0
US
How do you use nested quotation marks in a string?
I need to put double quotes in to a string and cannot find out how to do it.

Ex:

x = " "Some string" "

I have tried several ways but cannot find how to do it and cannot find it in a book, etc.

Help appreciated!
Thanks!
 
Try

? """Some string"""

? chr$(34) & "Some string" & chr$(34)

Roy-Vidar
 
Hi,

also, if you're doing a lot of 'quoting' in one output, all of the chr$(34)'s take up a lot of room making it harder to see what you're doing...

you could try variables...

SM = chr$(34) for a speech mark
CR = chr$(13) for a carriage return

output = SM & "text" & SM & CR, etc...

Regards
Peter
 
VB already has a built-in constant represent carriage return: vbCr
 
Hi,

yes, I know, but it's four characters rather than two!

I'm not usually so picky, but I once needed to put several different text messages into the same output box for user information and each message spread over several lines.

I had so many 'chr$(xx)' that it was difficult to read exactly what I was doing in the code.

Regards
Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top