replacing a string that contains a " character

  • Thread starter Thread starter Milsnips
  • Start date Start date
M

Milsnips

Hi there,

i'm trying to do a string replace on something like the following

string MyString = myinput;
myinput = myinput.Replace("src="../content/","http://www.site.com/content/")

but, the "src="../content/" line isnt working, i tried 3 quotes, 4 quotes, 5
quotes, no luck, whats the correct syntax to do this (and replace a string
that contains a quote in it)?

thanks,
Paul
 
i'm trying to do a string replace on something like the following

string MyString = myinput;
myinput = myinput.Replace("src="../content/","http://www.site.com/content/")

but, the "src="../content/" line isnt working, i tried 3 quotes, 4 quotes, 5
quotes, no luck, whats the correct syntax to do this (and replace a string
that contains a quote in it)?

\" is the way to escape a " within a normal literal string. For a
verbatim literal, use "".

Jon
 
Aah yes i should have thought of it myself! :-))
Thanks for the replies from all.

regards,
Paul
 

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

Back
Top