6
I have the following URL:
String Url = "www.minhaUrl/pagina/meus parametros tem espaços em branco";
I need to turn it into:
String Url = "www.minhaUrl/pagina/meus%20parametros%20tem%20espaços%20em%branco";
6
I have the following URL:
String Url = "www.minhaUrl/pagina/meus parametros tem espaços em branco";
I need to turn it into:
String Url = "www.minhaUrl/pagina/meus%20parametros%20tem%20espaços%20em%branco";
14
Use the method
URLEncoder.encode("meus parametros tem espaços em branco", "UTF-8");
The Urlencoder is the best way to do this since you are messing with a URL and it will handle any other case necessary.
4
Url = Url.replaceAll(" ", "%20");
Browser other questions tagged java
You are not signed in. Login or sign up in order to post.
This is the correct way to treat URL’s, +1
– Artur Trapp