-
Notifications
You must be signed in to change notification settings - Fork 376
Open
Description
Something along the lines of:
function uintToString(uint v) constant returns (string str) {
uint maxlength = 100;
bytes memory reversed = new bytes(maxlength);
uint i = 0;
while (v != 0) {
uint remainder = v % 10;
v = v / 10;
reversed[i++] = byte(48 + remainder);
}
bytes memory s = new bytes(i);
for (uint j = 0; j < i; j++) {
s[j] = reversed[i - 1 - j];
}
str = string(s);
}
Source: https://ethereum.stackexchange.com/questions/10811/solidity-concatenate-uint-into-a-string
Metadata
Metadata
Assignees
Labels
No labels