title: Need to replace spaces inside string with percentual symbol Java
body: <p>I need to replace the spaces inside a string with the % symbol but I'm having some issues, what I tried is:</p>
  
  <pre><code>imageUrl = imageUrl.replace(' ', "%20");
  </code></pre>
  
  <p>But It gives me an error in the replace function.</p>
  
  <p>Then:</p>
  
  <pre><code>imageUrl = imageUrl.replace(' ', "%%20");
  </code></pre>
  
  <p>But It still gives me an error in the replace function.</p>
  
  <p>The I tried with the unicode symbol:</p>
  
  <pre><code>imageUrl = imageUrl.replace(' ', (char) U+0025 + "20");
  </code></pre>
  
  <p>But it still gives error.</p>
  
  <p>Is there an easy way to do it?</p>