I have following strings:
S/. 05.56
S/. 0.0
S/. 0.00
S/. 90.10
S/. 01.23
S/. 1.00
S/.1.80
$/.9.80
$/. 10.80
$/. 89.81
$ 89.81
I n
Use ^\\D+
to replace all non-digits from the beginning of each string.
public static void main(String[] args) {
String[] str = { "S/. 05.56", "S/. 0.0", "S/. 0.00", "S/. 90.10", "S/. 01.23", "S/. 1.00", "S/.1.80",
"$/.9.80", "$/. 10.80", "$/. 89.81", "$ 89.81" };
for (String s : str) {
System.out.println(s.replaceAll("^\\D+", ""));
}
}
O/P :
05.56
0.0
0.00
90.10
01.23
1.00
1.80
9.80
10.80
89.81
89.81