title: How to replace a single character in a string?
body: <p>I'm trying to replace a character in a string after getting the string as input from the user super simple like this:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>$thestring = Read-Host;
  </code></pre>
  
  <p>And now I want to change the 2nd character of the string. I don't care what letter the 2nd char is, but it needs to be set to 'a'.</p>
  
  <p>I found the <code>Replace()</code> method to replace a chosen character:</p>
  
  <pre class="lang-bsh prettyprint-override"><code>$thestring = $string.Replace('b','a');
  </code></pre>
  
  <p>But it only goes for a given character. In C++ I would just say something like</p>
  
  <pre class="lang-cpp prettyprint-override"><code>thestring[1] = 'a';
  </code></pre>
  
  <p>And I'm trying to find something equal in PowerShell.</p>