Split a infix String to an array of String in java -


i working on mini scientific calculator works on infix postfix algorithm. input infix string .. , infix postfix conversion logic requires array of string. how can split infix string this:

 100+(0.03*55)/45-(25+55) 

to array of string in each operand , operator array element.

 "100" , "+" , "(" , "0.03" , "*" , "55" , ")" , "/" , "45" , "-" 

and on...

note there no space in string can't split on basis of regex " ".

here's algorithm use:

start empty string array, , empty string buffer

  • walk character 0 character n
  • for current character determine type (digit/period, open paren, close paren, math operators)
  • if current character type same last character type
  • add current character buffer
  • if not same, put buffer array of string, , start new buffer

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -