EOS contract uint128 convert to std::string
static const char* charmap = "0123456789";
std::string uint128ToString(const uint128_t& value)
{
std::string result;
result.reserve( 40 ); // max. 40 digits possible ( uint64_t has 20)
uint128_t helper = value;
do {
result += charmap[ helper % 10 ];
helper /= 10;
} while ( helper );
std::reverse( result.begin(), result.end() );
return result;
}
https://eosio.stackexchange.com/questions/2927/how-can-i-convert-a-uint128-t-to-a-string
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »