Skip to content Skip to sidebar Skip to footer

Android Replace Strings

How do you replace strings when you retrieve a data from an activity ? I cant seems to find it google. Maybe my question is too simple. Please see the below codes. Intent in = get

Solution 1:

Here textToPass is string so you can directly apply replace method on it .

textToPass.replace(".txt","");

Solution 2:

Intentin= getIntent();
StringtextToPass= in.getStringExtra("textToPass");
String[] exampletext = textToPass.split("//.");

Then use exampletext[0] it must give your expectation result

Post a Comment for "Android Replace Strings"