Re: Evaluate an string.
Posted in 1998
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
Juan Manuel Hernandez del Olmo wrote: > > Evaluate an string. > ------------------------------ > I would know if it is possible, in 4GL, to evaluate an string. For = > example: > > If I have: > > let cad='var1+var2*var3' > > Could I get something like this: > > num=eval cad > > So, if var1,var2 and var3 are integers, and its values are 1,2 and 3, the = > value of num would be 6. Actually 1+2*3 is either 7 or 9 depending on the order of evaluation. Using standard rules that would be 7. Anyway... No you cannot do this. You will have to build your own expression parser for this. Art S. Kagel