Board index » delphi » I need help comparing 2 string var for order of presedence

I need help comparing 2 string var for order of presedence

I have two variables: Input_Str <---read from a txt file and
TopStr<----Top of a Stack of Operators.

I need some code to compare these two to determine if:

Input_Str is of higher presedence than TopStr...

If anyone can help me please post a message here!

* (highest presedence)
/
+
- (lowest presedence)

These four are the only ones I need

Thanks
Brian

 

Re:I need help comparing 2 string var for order of presedence


In article <32A27D99.1...@sprynet.com> of Sun, 1 Dec 1996 22:56:25 in
comp.lang.pascal.borland, Brian Isaacs <bisa...@sprynet.com> wrote:

Quote
>I have two variables: Input_Str <---read from a txt file and
>TopStr<----Top of a Stack of Operators.

>I need some code to compare these two to determine if:

>Input_Str is of higher presedence than TopStr...

>If anyone can help me please post a message here!

>* (highest presedence)
>/
>+
>- (lowest presedence)

>These four are the only ones I need

Input_Str is of higher precedence than TopStr if
        Pos(InputStr, '-+/*') > Pos(TopStr, '-+/*')
'-+/*' should of course be a predefined constant.
--
John Stockton, Surrey, UK.  J...@merlyn.demon.co.uk  Turnpike v1.12  MIME
    http://www.merlyn.demon.co.uk/

Other Threads