What is the regular expression for replaceAll() function to replace "N/A" with "0" ?
input : "N/A" output : "0"
thanx
What is the regular expression for replaceAll() function to replace "N/A" with "0" ?
input : "N/A" output : "0"
thanx
Assuming s is a String
.
s.replaceAll("N/A", "0");
You don't even need regular expressions for that. This will suffice:
s.replace("N/A", "0");
Why use a regular expression at all? If you don't need a pattern, just use replace
:
String output = input.replace("N/A", "0");