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 4 3895
"Milsnips" <mi******@hotmail.comwrote in message
news:Oi**************@TK2MSFTNGP06.phx.gbl...
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)?
Insert a backslash before the quote:
myinput.Replace("src=\"../content/","http://www.site.com/content/")
Shouldn't it be .Replace
("src=\"../content/\","src='http://www.site.com/content/'") ?
"Milsnips" wrote:
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
On May 17, 9:11 am, "Milsnips" <milsn...@hotmail.comwrote:
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
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
On May 17, 9:11 am, "Milsnips" <milsn...@hotmail.comwrote:
>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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: C# Learner |
last post by:
What's the "standard" way of replacing a character in a string?
Obviously, I can't say "myString = character;" because strings
are immutable...
So what would be the "standard" way of doing this?...
|
by: Jim Lawton |
last post by:
Hello group,
I'm not very experienced in C#, but I can't find any example of this (common)
programming problem.
I have a string which contains a repeated substring - lets say it's like :-
...
|
by: VMI |
last post by:
If I have the string "Héllo", how can I replace char (é) with an 'e'? I
cannot use the String.Replace() fuction. It has to be by replacing one char
with another.
Thanks.
|
by: anonymous |
last post by:
Hello,
I need to replace this char  with another char.
However I am not able to acieve this. I tried this but it
doesnt work:
str = str.Replace(chr(asc(194)), "")
Can somebody help ?
|
by: Adam J. Schaff |
last post by:
I am writing a quick program to edit a binary file that contains file paths
(amongst other things). If I look at the files in notepad, they look like:
...
|
by: Adnan Siddiqi |
last post by:
Hi
Suppose I have following URLs comming from an HTML document
<a href="http://mydomain1.com">Domain1</a>
<a...
|
by: Ed |
last post by:
Hi All,
The sample code below doesn't work, but if you take out the Question
Mark character, "?" in front of the value "Print" of the "action"
attribute, it does work!
Does anyone here know...
|
by: Choi |
last post by:
Hi !
I wonder how I can replace a quote by a "\n" in a string.
For example my string is rrrrrrr'ttttttt and I want to obtain :
rrrrrrr
ttttttt
I tried the function find, but I don't know...
|
by: paulcybulski |
last post by:
I am trying to pass a URL to the body of an e-mail using a shell...however the string I am trying to pass as the URL contains a "&" character which is being treated as an operator by the complier and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |