title: Replace single instances of a character that is sometimes doubled
body: <p>I have a string with each character being separated by a pipe character (including the <code>"|"</code>s themselves), for example:</p>
  
  <pre><code>"f|u|n|n|y||b|o|y||a||c|a|t"
  </code></pre>
  
  <p>I would like to replace all <code>"|"</code>s which are not next to another <code>"|"</code> with nothing, to get the result:</p>
  
  <pre><code>"funny|boy|a|cat"
  </code></pre>
  
  <p>I tried using <code>mytext.replace("|", "")</code>, but that removes everything and makes one long word.</p>