Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Evaluation of numerics
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00413400
Message ID:
00414599
Views:
23
Yes! Hugo... that is what I was looking for. Thanks a lot. :)

>Marc, are you looking for something like this?
>
>? operate('120+5%') && -> 126
>? operate('120-5%') && -> 114
>? operate('110+10+5%) && -> 126
>
>value=120
>perc=5
>? operate('value+perc%') && -> 126
>
>
>
>function operate
>lparameters lcOperation
>local lnPosPlus, lnPosMinus, lnPos, lcValue, lcPerc
>
>lnPosPlus=rat('+', lcOperation)
>lnPosMinus=rat('-', lcOperation)
>
>if (lnPosPlus=0 and lnPosMinus=0) or right(lcOperation, 1)#'%'
>	return null && or whatever, like evaluate(lcOperation)
>else
>	lnPos=max(lnPosPlus, lnPosMinus)
>	lcValue=left(lcOperation, lnPos-1)
>	lcPerc=substr(lcOperation, lnPos+1, len(lcOperation)-lnPOs-1)
>	lnReturn=evaluate(lcValue+substr(lcOperation, lnPos, 1)+'(('+lcValue+')*'+lcPerc+'/100)')
>endif
>return lnReturn
>

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform