Hi all,
I want to replace the perticular character from the string .
My string is
string original="(My friend name is "WALTERS K,SCHULTHIES SPL ","Lenny")";
Above is my string and i want to remove the comma only is in the first double quote from the string and replace with a single space.
If comma ocuur otherwise in my string then i want to keep this as it is. No change in the whole string .
then Output that i want is the
(My friend name is "WALTERS K SCHULTHIES SPL ","Lenny")
How i will do it?
Loading


Yin45 reputationPosted Oct 8, 2012, 12:36 AM EDT
string original2 = original.Replace(","," ");
R ACHUTHA181 reputationPosted Oct 4, 2012, 11:04 PM EDT
try the below one
Yin45 reputationPosted Oct 8, 2012, 12:30 AM EDT
string new_orig = Replace(original, ","," ");
Mai Hu Na84 reputationPosted Oct 8, 2012, 9:13 PM EDT
for ex:-
i want index of 2nd comma(,) in below string
string original = "(My friend name is \"WALTERS K,SCHULTHIES SPL \",\"Lenny\",salunke)";
output expected is
(My friend name is "WALTERS K,SCHULTHIES SPL " "Lenny",salunke)
VulpesRank #55 · 29.2K reputationPosted Oct 11, 2012, 1:06 AM EDT
You can also use a regular expression :