skaur
skaur

Reputation: 168

Android: replaceAll() and double quote issue issue

I dont know where I m going wrong.. I want to replace " with "" I have used the following code.

input.replaceAll("\"", "\"\"");

this doesnt seem to work. Any suggestions?

Upvotes: 1

Views: 455

Answers (2)

MByD
MByD

Reputation: 137382

Strings are immutable, so you need to assign it into another String:

input = input.replaceAll("\"", "\"\"");

Upvotes: 1

sahhhm
sahhhm

Reputation: 5365

Strings are immutable, so when you "change" your string, you need to reassign it.

input = input.replaceAll("\"", "\"\"");

Upvotes: 1

Related Questions