user590849
user590849

Reputation: 11765

The following code not working in android?

details.replaceAll("null", " ");

In the above code i am getting the String details from the database and it may get values of the form : null,null,null,null.

In order to remove all the "null" from the string i am using the above code, but it is not working.

what is going wrong?

thank you in advance.

Upvotes: 0

Views: 97

Answers (1)

dlev
dlev

Reputation: 48596

replaceAll will not change the String itself, but return a new String with the replacements made. You must assign the return value to get your code to work:

details = details.replaceAll("null", " ");

Upvotes: 3

Related Questions