how to replace some character b/w strings in c#?
suppose
string is : 1-2-5-7-8-9-10-15
i use replace function
when i replace 5 with 2
it also replace the last 15 to 12 because of 5 there.
so how can i get the right output?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use this:
In contrast to most of the other answers here, this also handles the case, when the string to be replaced is at the beginning or the end of the input string.