相当于java中的eval()函数 [英] Equivalent to eval() function in java

查看:189
本文介绍了相当于java中的eval()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我试图评估vb.net中的以下声明,但我不知道该怎么做,所以任何人都可以帮助

我?



Hi im trying to evaluate below statement in vb.net but i don't know how to do that so anyone can help
me ?

var code = eval("(0x4247f4e627ca7065145406ab01f7f7e3)");
alert(code);





得到了结果8.810266794149574e + 37



我希望在.NET中完成这个



更新:





and got the result "8.810266794149574e+37"

I want this to be done in .NET

Update:

function getPoW(a, b) {
        var c = 0;
        do hash_hex = md5(md5(b + c)), hash = eval("(0x" + hash_hex + ")"), ++c; while (hash >= a);
        return c
}





谢谢提前:)



Thanks in advance :)

推荐答案

你在那里几乎失败了 - .NET不容易支持大于int64的数字 - 这是一个int128,它不会甚至适合小数...



有BigIntger类:

You are pretty much on a loser there - .NET does not easily support numbers larger than int64 - and that is an int128, which won't even fit in a decimal...

There is the BigIntger class:
Dim hexString As String = "4247f4e627ca7065145406ab01f7f7e3"
Dim bi As BigInteger = BigInteger.Parse(hexString, System.Globalization.NumberStyles.HexNumber)



但是否对你有用取决于什么你打算做数据......


But whether that is useful to you depends on what you are planning on doing with the data...


这篇关于相当于java中的eval()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆