For implementation specific reasons, I have to use Java 1.2. I am trying to parse a String
object with only numbers (I replace variables beforehand to abstract that step) and operators (PEDMAS). I have found a lot of libraries that do this well, but unfortunately nothing that is compatible with Java 1.2 (Even with fiddling, all of them are dependent on things like generics). Obviously I'm capable of making this myself, but I would certainly prefer to not remake the wheel. Are there any libraries that I just haven't found yet that could do this for me? Thanks.
(Requirements: Binary operators and parentheses)
EDIT: As requested, some examples of input and output:
- "(10 / 5) + 4.5 - (8)" would give you -1.5
- "(1/3) * 4" would give you 1.3333333...
- "5^3 + 4 * 2" would give you 133
- "-10 + 5" would give you -5
Hopefully that makes sense.