String Math Expression Calculator

String Math Expression Calculator

Calculates string math expressions from user input or other sources. Includes calculator UI component for out of the box usefulness.

  • Language: Java
  • Released: May 28, 2011
    Last Update: May 26, 2011

Expression calculator

  • Ease to use: Calc.eval("(100+1)*(100-1)"); // returns 9999
  • Supported parentheses. For example:2*(5-3)
  • BigDecimal numbers. For example: 1000000000000000000000000+2000000000000000000000000 // One Septillion + Two Septillion
  • Simple ready-to-use UI component included (with full source code for customization):

simple calculator

Hide

Sample

Use UI Component:

import com.programmisty.calc.*;

public class Sample1 {
    public static void main(String a[]) throws Exception {
       // Change UI Look And Feel (If needed)  //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        JFrame frame = new JFrame("Simple Calculator");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Important! ADD CALCULATOR PANEL
        frame.getContentPane().add(new CalculatorPanel());
        frame.pack();
        frame.setVisible(true);
    }
}

Use API :

import com.programmisty.calc.*;
import java.math.BigDecimal;
public class Sample2 {
    public static void main(String args[]) throws Exception {
           BigDecimal a = Calc.eval("100+100/5");
           double x = Calc.deval("100+100/4");
           int y = Calc.ieval("100+100/4");
    }
}
You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

X

Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

1 license From » $7.99 14 day money-back guarantee View Licenses
or Get a quote

for customization or integration services

Post a comment

Or enter your name and Email
  • RG Roedy Green 3 years ago
    This would be even more useful as a posted applet so you could use it without installing.