title: String methods in Swift to replace the first character in a string
body: <p>Say I have a string that contains three underscores</p>
  
  <pre><code>var myString = "___"
  </code></pre>
  
  <p>Given a number, the string should look like this</p>
  
  <pre><code>myString = "1__"
  </code></pre>
  
  <p>If the user types a new number, say 2, the string will change</p>
  
  <pre><code>myString = "12_"
  </code></pre>
  
  <p>Given a <code>number</code>, I tried coding this situation:</p>
  
  <pre><code>for i in myString.characters {
      if (i == "_") {
          newString = myString.stringByReplacingOccurrencesOfString("_", withString: number, options: NSStringCompareOptions.LiteralSearch, range: nil)
          break
      }
  }
  </code></pre>
  
  <p>The problem is that <code>stringByReplacingOccurrencesOfString</code> replaces the characters all at once. What string method do you think I should use instead?</p>