• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

manipulate strings with integers and operators

 
ashleys smith
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a calculator for doubles and one of the things I wanted to do was was take in negative numbers and exponents numbers . But I am having trouble doing that and I was wondering if someone could help me figure it out I set up a pattern from the E and e. The user input can look like that as a String = "-(a1+-a2)*10E-10" and it can also look like this "(-a1+-a2)*10E3" anyone know how I can make it look like this " ( -a1 + -a2 ) * 10000 " so I can apply the split method and parse it to the stacks =)
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi and welcome to the javaranch,

You could search for the E followed by a number and replace what with the corresponding value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic