Android string replace by another string

 

Android string replace ??

 

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

 

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

Then here empty space will be replaced by ‘-‘

 

Output will be

"Welcome-to-AndroidCoding.in"

 

And also when ever you want to send any variable which may contains spaces in between through php(sometimes)  then the value after the space may be eliminated so to avoid the elimination of text after 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

[et_pb_section admin_label="section"][et_pb_row admin_label="row"][et_pb_column type="4_4"][et_pb_text admin_label="Text" background_layout="light" text_orientation="left" use_border_color="off" border_color="#ffffff" border_style="solid"] Android toggle button : Introduction : Android has provided wide...

Close