title: Replace a character with different characters depending on which character it is
body: <p>I have searched SO (and Google) but not found any fully matching answer to my question:</p>
  
  <p>I want to replace all swedish characters and whitespace in a <code>String</code> with another character. I would like it to work as follows:</p>
  
  <ul>
  <li>"å" and "ä" should be replaced with "a"</li>
  <li>"ö" should be replaced with "o"</li>
  <li>"Å" and "Ä" should be replace with "A"</li>
  <li>"Ö" should be replaced with "O"</li>
  <li>" " should be replaced with "-"</li>
  </ul>
  
  <p>Can this be achieved with regex (or any other way), and if so, how?</p>
  
  <p>Of course, the below method does the job (and can be improved, I know, by replacing for example "å" and "ä" on the same line):</p>
  
  <pre><code>private String changeSwedishCharactersAndWhitespace(String string) {
      String newString = string.replaceAll("å", "a");
      newString = string.replaceAll("ä", "a");
      newString = string.replaceAll("ö", "o");
      newString = string.replaceAll("Å", "A");
      newString = string.replaceAll("Ä", "A");
      newString = string.replaceAll("Ö", "O");
      newString = string.replaceAll(" ", "-");
      return newString;
  }
  </code></pre>
  
  <p>I know how to use regex to replace, for example, all "å", "ä", or "ö" with "". The question is <strong>how do I replace a character using regex with another depending on which character it is</strong>? There must surely be a better way using regex than the above aproach?</p>