title: Replace a character with a string in LaTeX
body: <p>I'm looking for a way to do a substring replace on a string in LaTeX.  What I'd like to do is build a command that I can call like this:</p>
  
  <pre><code>\replace{File,New}
  </code></pre>
  
  <p>and that would generate something like</p>
  
  <pre><code>\textbf{File}$\rightarrow$\textbf{New}
  </code></pre>
  
  <p>This is a simple example, but I'd like to be able to put formatting/structure in a single command rather than everywhere in the document.  I know that I could build several commands that take increasing numbers of parameters, but I'm hoping that there is an easier way. </p>
  
  <p><strong>Edit for clarification</strong></p>
  
  <p>I'm looking for an equivalent of </p>
  
  <pre><code>string.replace(",", "$\rightarrow$)
  </code></pre>
  
  <p>something that can take an arbitrary string, and replace a substring with another substring.</p>
  
  <p>So I could call the command with \replace{File}, \replace{File,New}, \replace{File,Options,User}, etc., wrap the words with bold formatting, and replace any commas with the right arrow command.  Even if the "wrapping with bold" bit is too difficult (as I think it might be), just the replace part would be helpful.</p>