title: How to replace a string pattern in a string with a unicode character
body: <p>I have a string <code>&quot;This is a symbol U+0202 and so is this U+023B&quot;</code> that I want to replace every occurrence of the string pattern &quot;U+XXXX&quot; with <code>\u{XXXX}</code>.  For example, an extension to <code>String</code> that does that:</p>
  <pre><code>extension String {
    var withConvertedUnicodeSymbols : String { ... }
  }
  </code></pre>
  <p>Example:</p>
  <pre><code>var string0 = &quot;This is a symbol U+0202 and so is this U+023B&quot;
  var string1 = string0.withConvertedUnicodeSymbols
  // string1 = &quot;This is a symbol \u{0202} and so is this \u{023B}&quot;
  print(string1)
  // prints: This is a symbol Ȃ and so is this Ȼ
  </code></pre>