String
Functions
truncate32
Truncates a string to 32 bytes
function truncate32(string memory str_) internal pure returns (string memory);
bytes32ToString
Converts a bytes32 value to a string
Extracts a null-terminated string from bytes32 (stops at the first null byte)
function bytes32ToString(bytes32 value_) internal pure returns (string memory);
Parameters
| Name | Type | Description |
|---|---|---|
value_ | bytes32 | The bytes32 value to convert to a string |
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | string The string representation of the bytes32 value |
substring
Returns a substring of a string
function substring(string memory str_, uint256 startIndex_, uint256 endIndex_)
internal
pure
returns (string memory);
Parameters
| Name | Type | Description |
|---|---|---|
str_ | string | The string to get the substring of |
startIndex_ | uint256 | The index to start the substring at |
endIndex_ | uint256 | The index to end the substring at |
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | resultString The substring |
substringFrom
Returns a substring of a string from a given index
function substringFrom(string memory str_, uint256 startIndex_) internal pure returns (string memory);
Parameters
| Name | Type | Description |
|---|---|---|
str_ | string | The string to get the substring of |
startIndex_ | uint256 | The index to start the substring at |
Returns
| Name | Type | Description |
|---|---|---|
<none> | string | resultString The substring |
Errors
EndBeforeStartIndex
error EndBeforeStartIndex(uint256 startIndex, uint256 endIndex);
EndIndexOutOfBounds
error EndIndexOutOfBounds(uint256 endIndex, uint256 length);