Write a line in a text file with quotes in it

  • Thread starter cdiaz1116 via AccessMonster.com
  • Start date
C

cdiaz1116 via AccessMonster.com

Hi All.

I need to write a line in a text file that contains quotes I need the output
to be:

"NotifyRouterUpdate"="EM"

I've tried encapsulating the entire string in another set of qoutes:
filetxt.WriteLine (""NotifyRouterUpdate" = "EM"")

but I am getting an error:

Compile Error:

Expected: list seperator or )

Thanks
 
M

Marshall Barton

cdiaz1116 said:
I need to write a line in a text file that contains quotes I need the output
to be:

"NotifyRouterUpdate"="EM"


You need to use two quotes when you want one inside the
text.

"NotifyRouterUpdate""=""EM"
 
J

John W. Vinson

Hi All.

I need to write a line in a text file that contains quotes I need the output
to be:

"NotifyRouterUpdate"="EM"

I've tried encapsulating the entire string in another set of qoutes:
filetxt.WriteLine (""NotifyRouterUpdate" = "EM"")

but I am getting an error:

Compile Error:

Expected: list seperator or )

Thanks

A quoted string starts with a " and ends with the next " - so you're getting a
zero length string "", followed by an (UNQUOTED!) text NotifyRouterUpdate,
followed by a text string " = " and so on.

The trick to include a doublequote inside a string delimited by doublequotes
is to double the doublequote: "" inside a string constant will be interpreted
as a " character. So try

filetxt.WriteLine ("""NotifyRouterUpdate"" = ""EM""")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top