开发者

how do I split string equation into its own array of strings? [duplicate]

开发者 https://www.devze.com 2023-04-08 13:12 出处:网络
This question already has answers here:开发者_如何学JAVA Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_如何学JAVA Closed 11 years ago.

Possible Duplicate:

How would I Evaluate a certain formula?

How would I split this formula into an array of characters each having their own number in the array:

a1+a2+a5*((a1+a6)*a3)

one I have added the spaces I am going to get column 1 because a1 will indicate column one and it will contain a number than I will add that to column 2. I am not allowed to use a tree or any of those other things just stacks and I have been asking that. But people keep telling me to use libraries and trees I am only in a 200 level course !


You need a grammar and a parser to do this in a general way. Something like this.

0

精彩评论

暂无评论...
验证码 换一张
取 消