Replace part of a string with new value
<p>I've got a scenario, wherein i need to replace the string literal with new text.</p>

<p>For example, if my string is "01HW128120", i will first check if the text contains "01HW" If yes, then replace that with the string "MachineID-".</p>

<p>So eventually i wanted "01HW128120" to be "MachineID-128120". Sometimes i do get the string as "1001HW128120" - In this case also i require to replace the "1001HW" with "MachineID-"
I tried the below code snippet, but this does not work to my expectation.</p>

<pre><code>string sampleText = "01HW128120";
if(sampleText.Contains("01HW"))
  sampleText = sampleText.Replace("01HW","MachineID-");
</code></pre>

<p>Any suggestion would be of great help to me.</p>
