Yes, you can just split it and then compose again; for split, use
string.Split
, to compose the array of sub-string back to one string (with proper replacement), use
string.Format
. Do not use concatenation "+", due to poor readability (easy to make a mistake) and pure performance (because strings are
immutable). See
http://msdn.microsoft.com/en-us/library/system.string.aspx[
^].
This method is maybe not so elegant. Many would prefer using Regular Expressions. You will need to use one of the methods
System.Text.RegularExpressions.Regex.Replace
, see
http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx[
^].
You will need to learn Regular Expressions though, but it can be useful for other cases. See:
http://en.wikipedia.org/wiki/Regular_expression[
^],
http://en.wikipedia.org/wiki/Regular_expression_examples[
^].
This is a great tool to use:
http://www.ultrapico.com/Expresso.htm[
^].
—SA