title: Chaining string.replace in F#
body: <p>I have a string with some tokens in it like this:</p>
  
  <pre><code>"There are two things to be replaced.  {Thing1} and {Thing2}"
  </code></pre>
  
  <p>I want to replace each token with different values so the final result looks like this:</p>
  
  <pre><code>"There are two things to be replaced.  Don and Jon"
  </code></pre>
  
  <p>I created a function that chains String.Replace like this</p>
  
  <pre><code>let doReplacement (message:string) (thing1:string) (thing2:string) =
      message.Replace("{Thing1}", thing1).Replace("{Thing2}", thing2)
  </code></pre>
  
  <p>the problem is that when I chain .Replace, the values have to stay on the same line.  Doing this does not work:</p>
  
  <pre><code>let doReplacement (message:string) (thing1:string) (thing2:string) =
      message
      .Replace("{Thing1}", thing1)
      .Replace("{Thing2}", thing2)
  </code></pre>
  
  <p>To allow me to do a multi-line chain, I was thinking of something like this:</p>
  
  <pre><code>message
  |&gt; replaceString "{Thing1}" thing1
  |&gt; replaceString "{Thing2}" thing2
  </code></pre>
  
  <p>with a supporting function like this:</p>
  
  <pre><code>let replaceString (message:string) (oldValue:string) (newValue:string) =
      message.Replace(oldValue, newValue)
  </code></pre>
  
  <p>However, that does not work.  Is there another way to handle the problem?</p>