Crate bitcoin_string

Source

Modules§

tinyformat

Structs§

BilingualStr
| Bilingual messages: | | - in GUI: user’s native language + untranslated | (i.e. English) | | - in log and stderr: untranslated only |

Enums§

SafeChars
| Used by SanitizeString() |

Constants§

CHARS_ALPHA_NUM
UPPER_BOUND
| Upper bound for mantissa. | | 10^18-1 is the largest arbitrary decimal that | will fit in a signed 64-bit integer. | | Larger integers cannot consist of arbitrary | combinations of 0-9: | | 999999999999999999 1^18-1 | 9223372036854775807 (1<<63)-1 (max int64_t) | 9999999999999999999 1^19-1 (would overflow)
util_hexdigit

Traits§

ToLower
ToUpper

Functions§

capitalize
| Capitalizes the first character of | the given string. | | This function is locale independent. | It only converts lowercase characters | in the standard 7-bit ASCII range. | | This is a feature, not a limitation. | | ———– | @param[in] str | | the string to capitalize. | | ———– | @return | | string with the first letter capitalized. |
convert_bits
| Convert from one power-of-2 number | base to another. |
decode_base32
decode_base64
decode_base32_bytes
decode_base64_bytes
encode_base32
| Base32 encode. | | If pad is true, then the output will | be padded with ‘=’ so that its length | is a multiple of 8. |
encode_base64
encode_base32_bytes
| Base32 encode. | | If pad is true, then the output will | be padded with ‘=’ so that its length | is a multiple of 8. |
encode_base64_bytes
format_money
| Do not use these functions to represent | or parse monetary amounts to or from | | JSON but use AmountFromValue and ValueFromAmount | for that. |
has_prefix
| Check whether a container begins with | the given prefix. |
hex_digit
hex_str
| Convert a span of bytes to a lower-case | hexadecimal string. |
is_digit
| Tests if the given character is a decimal | digit. | | ———– | @param[in] c | | character to test | | ———– | @return | | true if the argument is a decimal digit; | otherwise false. |
is_hex
| Returns true if each character in str | is a hex character, and has an even number | of hex digits. |
is_hex_number
| Return true if the string is a hex number, | optionally prefixed with “0x” |
is_space
| Tests if the given character is a whitespace | character. The whitespace characters | are: | | space, | form-feed (‘\f’), | newline (‘\n’), | carriage return (‘\r’), | horizontal tab (‘\t’), | and vertical tab (‘\v’). | | This function is locale independent. | Under the C locale this function gives | the same result as std::isspace. | | ———– | @param[in] c | | character to test | | ———– | @return | | true if the argument is a whitespace | character; otherwise false |
join
locale_independent_atoi
| LocaleIndependentAtoi is provided for backwards | compatibility reasons. | | New code should use ToIntegral or the ParseInt* | functions which provide parse error feedback. | | The goal of LocaleIndependentAtoi is to | replicate the exact defined behaviour of atoi | and atoi64 as they behave under the “C” locale.
make_unordered_list
| Create an unordered multi-line list | of items. |
parse_fixed_point
| Parse number as fixed point according | to JSON number syntax. | | See https://json.org/number.gif | | ———– | @note | | The result must be in the range (-10^18,10^18), | otherwise an overflow error will trigger. | | ———– | @return | | true on success, false on error. |
parse_hex
parse_int32
| Convert string to signed 32-bit integer | with strict parse error feedback. | | | ———– | @return | | true if the entire string could be parsed | as valid integer, false if not the entire | string could be parsed or when overflow | or underflow occurred. |
parse_int64
| Convert string to signed 64-bit integer | with strict parse error feedback. | | ———– | @return | | true if the entire string could be parsed | as valid integer, false if not the entire | string could be parsed or when overflow | or underflow occurred. |
parse_integral
parse_money
| Parse an amount denoted in full coins. | E.g. “0.0034” supplied on the command | line. * |
parse_uint8
| Convert decimal string to unsigned | 8-bit integer with strict parse error | feedback. | | ———– | @return | | true if the entire string could be parsed | as valid integer, false if not the entire | string could be parsed or when overflow | or underflow occurred. |
parse_uint16
| Convert decimal string to unsigned | 16-bit integer with strict parse error | feedback. | | ———– | @return | | true if the entire string could be parsed | as valid integer, false if the entire | string could not be parsed or if overflow | or underflow occurred. |
parse_uint32
| Convert decimal string to unsigned | 32-bit integer with strict parse error | feedback. | | ———– | @return | | true if the entire string could be parsed | as valid integer, false if not the entire | string could be parsed or when overflow | or underflow occurred. |
parse_uint64
| Convert decimal string to unsigned | 64-bit integer with strict parse error | feedback. | | | ———– | @return | | true if the entire string could be parsed | as valid integer, false if not the entire | string could be parsed or when overflow | or underflow occurred. |
process_mantissa_digit
| Helper function for ParseFixedPoint |
remove_prefix
sanitize_string
| Remove unsafe chars. Safe chars chosen | to allow simple messages/URLs/email | addresses, but avoid anything even | possibly remotely dangerous like & | or > | | ———– | @param[in] str |
timing_resistant_equal
| Timing-attack-resistant comparison. | | Takes time proportional to length of | first argument. |
to_integral
| Convert string to integral type T. Leading | whitespace, a leading +, or any trailing | character fail the parsing. | | The required format expressed as regex | is -?[0-9]+. The minus sign is only | permitted for signed integer types. | | ———– | @return | | std::nullopt if the entire string could | not be parsed, or if the parsed value | is not in the range representable by | the type T. |
to_string
| Locale-independent version of std::to_string |
trim_string
untranslated
| Mark a bilingual_str as untranslated |
valid_as_cstring
| Check if a string does not contain any | embedded NUL (\0) characters |