Is there any equivalent string function or library in java that behaves the way oracle translate function does?
In oracle I can do this:
select translate(
'23423k!(dfgd){sdf};',
'(){}k!',
'{}()'
) from dual;
to get this:
23423{dfgd}(sdf);
But in java, if i did this:
String a="23423k!(dfgd){sdf};";
String b=a
.replace("(", "{")
.replace(")", "}")
.replace("{", "(")
.replace("}", ")")
.replace("!", "")
.replace("k", "")
;
System.out.println("ori:"+a);
System.out.println("mod:"+b);
i get this:
ori:23423k!(dfgd){sdf};
mod:23423(dfgd)(sdf);