Replacing a String between 2 pipes c# : <p>I have a problem in C# to replace a string between two pipes or with an ending pipe.</p>

<p>Example: I want to replace the second value</p>

<p>Before: 0|<strong>1</strong>|2|3</p>

<p>After Replace: 0|<strong>4</strong>|2|3</p>

<p>How can I do this? The value can be also 2 digits or more.</p>

<p>And a second question: how can i replace the first value where is no beginning pipe?</p>

<p>It should be dynamicly to select which value I would like to change like "replaceString(string text, int valueindexToReplace, string replacewiht)"</p>

<p>Thank you for your help.</p>
