how can I parse and addition two value? Im usin this pattern:
String s = "6 + 7 =";
Included spacing, I need to get "13"
It is possible with regex, or there are an other way to do this easely?
Thanks in advance for ur help.
Does it have to be regex? If not you can use JavaScript engine (since Java 1.6) to do calculations from String, like:
ScriptEngineManager factory = new ScriptEngineManager();
// create a JavaScript engine
ScriptEngine engine = factory.getEngineByName("JavaScript");
Double d=(Double)engine.eval("1 + 2 * 3");
System.out.println(d);