May 21, 2024, 10:15:28 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


how to put a double quote into a string

Started by yujinwunz, February 21, 2009, 11:33:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yujinwunz

February 21, 2009, 11:33:05 PM Last Edit: February 21, 2009, 11:45:10 PM by Larry McCaughn
hi everyone

i seem to have forgotten how to put a double quote into a string. Help!

thanks

LarryMc

From the help file (which would help you if you read it):

QuoteString literals

A string literal is text enclosed in quotes. The compiler supports string escape sequences to insert special ASCII values into the string without having to use CHR$ to generate them. String literals are stored in the executable when compiled.

Examples:


Mystring = "This is a string"
' a string with embedded quotes
MyString2 = "This \"is\" a string"

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

yujinwunz

thanks. cant help irratic behavior though.

MarineDon

In my program, CB Browser, I have a line that looks like this:

Begin with:
Def q$[100]:istring 

Then IString q$:
q$="creating a text file, "+"\"" + "LoadURLs.Txt" + "\"" + " with Notepad. A maximum of 40 URLs."+"\n"

It prints out like this.
creating a text file, "LoadURLs.Txt" with Notepad. A Maximum of 40 URLs.

The technique is a little unusual but works well.

Regards, Don Smith [MarineDon]
Don Smith [MarineDon]
(deceased 2011)

LarryMc

Don,
Your's works but it reallity you're doing what the help file says do.
You're just breaking up a string for no reason.
your string:
q$="creating a text file, "+"\"" + "LoadURLs.Txt" + "\"" + " with Notepad. A maximum of 40 URLs."+"\n"

and what the manual says:
q$="creating a text file, \" LoadURLs.Txt \" with Notepad. A maximum of 40 URLs.\n"
give the same result

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library