Sometime’s we need to change some part of the string with other string then we can do this by using a method called string replace which does the work of replace the string with what we want to be replaced.


String android = "Welcome to";
= string.replace(" ", "-");

Then here empty space will be replaced by ‘-‘


Output will be



And also when ever you want to send any variable which may contains spaces in between through php(sometimes)  theb the value after the space may be eliminated so to avoid the elimination of text agter space use


android = string.replace(" ", "%20");


now value is never eliminated even though there is a space break between words.


Show Buttons
Hide Buttons
Read previous post:
Android Tutorial On Toggle Button