Question: I am trying to convert **uint** to **string** in solidity. Is it possible to convert? if so how can I convert it?

Convertion to base 10 is prefered, but in hexadecimal might also be helpful.

Answer: 
[Solidity is character set agnostic concerning strings.](http://solidity.readthedocs.io/en/latest/frequently-asked-questions.html#what-character-set-does-solidity-use) There is no built-in "toString" in Solidity. <https://github.com/pipermerriam/ethereum-string-utils> is a library that can help:

```
> stringUtils.uintToBytes(1234)
"1234"

```

The MIT licensed implementation is:

```
function uintToBytes(uint v) constant returns (bytes32 ret) {
    if (v == 0) {
        ret = '0';
    }
    else {
        while (v > 0) {
            ret = bytes32(uint(ret) / (2 ** 8));
            ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
            v /= 10;
        }
    }
    return ret;
}

```
Based on the Oraclize code that Dmitry supplied I made a function to return a `uint` as a `string` in hex format:

```
function uint2hexstr(uint i) internal pure returns (string) {
    if (i == 0) return "0";
    uint j = i;
    uint length;
    while (j != 0) {
        length++;
        j = j >> 4;
    }
    uint mask = 15;
    bytes memory bstr = new bytes(length);
    uint k = length - 1;
    uint numStart = 48;
    uint letterStarn = 65;
    while (i != 0){
        uint curr = (i & mask);
        bstr[k--] = curr > 9 ? byte(55 + curr ) : byte(48 + curr); // 55 = 65 - 10
        i = i >> 4;
    }
    return string(bstr);
}

```

<https://gist.github.com/okwme/f3a35193dc4eb9d1d0db65ccf3eb4034>