Home > Mobile >  replace a " from a String in Android Studio
replace a " from a String in Android Studio

Time:08-15

i have this string String answer = ""true<; And I want to delete the " before the true.

You can delete everything else with the

 answer = answer.replace(" ", "");

But with the " it does not work

I don't want to delete a space but delete the character " from a string

CodePudding user response:

try this out:

answer= answer.replace("\"", "");

When using replace and other functions, if you want a special character to be regarded as a character rather than a special character, you must use that character /

CodePudding user response:

it will work

nameDetail = nameDetail.replace("\"", "");
  • Related