I need to replace all the
'1' to 1
'100' to 100
You can use
replaceAll method with regex support:
str = str.replaceAll("'(\\d+)'", "$1");
(\\d+) will match and group digits surrounded by single quotes on either side and then we use
$1 in replacement which is the back-reference to captured value in regex.