日期:2014-05-20 浏览次数:20680 次
public static void main(String[] args) throws Exception {
String str = "0.000009*X^2-0.003963*X^3/0.00263*X^4+123.352425";
str = str.replaceAll("(?i)(x)\\^(\\d+)","Math.pow($1,$2)");
System.out.println(str);
}
System.out.println("0.000009*X^2-0.003963*X^3+123.352425".replaceAll("X\\^(\\d+)", "Math.pow(X,$1)"));