Reputation: 265
how can i remove %0A from this string :- this is enter key code, which i need to remove from entire string. so how can i do this?
input:-
"NA%0A%0AJKhell this is test %0A"
Output:-
NAJKhell this is test
i have tried
String input = "NA%0A%0AJKhell this is test %0A";
String output = input.replaceAll("%0A","");
but still not get the output.
Upvotes: 1
Views: 830
Reputation: 11958
replaceAll method takes a regex as parameter. Try to escape percent sign \\%
I think it will work
String input = "NA%0A%0AJKhell this is test %0A";
String output = input.replaceAll("\\%0A","");
Upvotes: 2
Reputation: 7916
If you are trying to use Regex API, so it should look like this:
input.replace("%A$", "");
- It will remove matching at the end of the String
(because of $)
If you want to remove all %A
, then
input.replaceAll("%A", "");
Upvotes: 1