"Juan" wrote:
[color=blue]
>
>
>
> If I have a string with a valid math expression like " (2 + 28)/1", how can
> I evaluate it?
>
>
>
> Thanks,
>
> Juan.
>
>
>
>[/color]
"Juan" <juan_mauricio_ lopez@ANTISPAMh otmail.com> wrote in message
news:uSraggvBFH A.1296@TK2MSFTN GP10.phx.gbl...[color=blue]
>
>
>
> If I have a string with a valid math expression like " (2 + 28)/1", how[/color]
can[color=blue]
> I evaluate it?[/color]
Re: How to evaluate a math expression contained in a string?
I'm not sure how safe this is, but I used this in a non-production
environment and it works quite well:
"Amiram Korach" <AmiramKorach@d iscussions.micr osoft.com> wrote in message
news:64F416D0-9314-47F8-B84D-3A2BFF0484B9@mi crosoft.com...[color=blue]
> You can always work hard and write it yourself, but I think you are not
> the
> first to meet this. I found something in CodeProject:
> http://www.codeproject.com/vb/net/ma..._evaluator.asp
> I you search yourself, I'm sure you'll find more.
>
> "Juan" wrote:
>[color=green]
>>
>>
>>
>> If I have a string with a valid math expression like " (2 + 28)/1", how
>> can
>> I evaluate it?
>>
>>
>>
>> Thanks,
>>
>> Juan.
>>
>>
>>
>>[/color][/color]
First you call the static Initialise, the pass your string to
EvaluateStringA sDouble() and it gives you the result back as a double.
"Amiram Korach" <AmiramKorach@d iscussions.micr osoft.com> wrote in message
news:64F416D0-9314-47F8-B84D-3A2BFF0484B9@mi crosoft.com...[color=blue]
> You can always work hard and write it yourself, but I think you are not
> the
> first to meet this. I found something in CodeProject:
> http://www.codeproject.com/vb/net/ma..._evaluator.asp
> I you search yourself, I'm sure you'll find more.
>
> "Juan" wrote:
>[color=green]
>>
>>
>>
>> If I have a string with a valid math expression like " (2 + 28)/1", how
>> can
>> I evaluate it?
>>
>>
>>
>> Thanks,
>>
>> Juan.
>>
>>
>>
>>[/color][/color]
Comment