title: How to replace the characher `\n` as a new line in android
body: <p>I have one server response for an API request as shown below.</p>
  
  <pre><code>Success! Your request has been sent.\n\nWe’ll inform you once it is done.
  </code></pre>
  
  <p>This message I need to show in a Snackbar. I need new line to be added in the place of <code>\n</code> in this response . I tried by using <code>replaceAll</code> like </p>
  
  <pre><code>String message = (serverResponse.getMessage()).replaceAll("\\n", System.getProperty("line.separator"));
  </code></pre>
  
  <p>but it is showing like this </p>
  
  <p><a href="https://i.stack.imgur.com/HfHdN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HfHdN.png" alt="enter image description here"></a></p>
  
  <p>Same message if I add in <code>string.xml</code> resource file and get using <code>getString(R.string.message)</code> then the <code>\n</code> is working properly. How can I get a new line from this response string?</p>
  
  <p>I tried changing <code>\n</code> with other character like <code>&lt;new_line&gt;</code> from server response and it is working fine with <code>replaceAll</code>. Problem is only with <code>\n</code> in response message. Is there any way to parse <code>\n</code>?</p>