How can I create a string by combining two strings and using substitution? : <p>I have code that creates two strings:</p>

<pre><code>var string1 = "ま|ちが|#";
var string2 = "間|違|う";
</code></pre>

<p>I'm looking for a way to combine these such the resulting output contains the characters from string1 but if the character is a "#" then it takes the alternate character from string2. </p>

<pre><code>string1      string2    desired output
ま|ちが|#     間|違|う      まちがう
な|#         為|る         なる
で|き|#      出|来|る      できる
</code></pre>

<p>Does anyone have any suggestions as to how I can do this?</p>
