```\nfunction toString(uint256 value) internal pure returns (string memory) {\n    unchecked {\n        uint256 length = Math.log10(value) + 1;\n        string memory buffer = new string(length);\n        uint256 ptr;\n        /// @solidity memory-safe-assembly\n        assembly {\n            ptr := add(buffer, add(32, length))\n        }\n        while (true) {\n            ptr--;\n            /// @solidity memory-safe-assembly\n            assembly {\n                mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n            }\n            value /= 10;\n            if (value == 0) break;\n        }\n        return buffer;\n    }\n}\n```\n