Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Evaluation of numerics
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00413400
Message ID:
00414599
Vues:
22
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform