Crate bitcoin_string

source ·

Modules

Structs

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

Enums

Constants

  • | 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)

Traits

Functions

  • | 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 from one power-of-2 number | base to another. |
  • | Base32 encode. | | If pad is true, then the output will | be padded with ‘=’ so that its length | is a multiple of 8. |
  • | Base32 encode. | | If pad is true, then the output will | be padded with ‘=’ so that its length | is a multiple of 8. |
  • | Do not use these functions to represent | or parse monetary amounts to or from | | JSON but use AmountFromValue and ValueFromAmount | for that. |
  • | Check whether a container begins with | the given prefix. |
  • | Convert a span of bytes to a lower-case | hexadecimal string. |
  • | 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. |
  • | Returns true if each character in str | is a hex character, and has an even number | of hex digits. |
  • | Return true if the string is a hex number, | optionally prefixed with “0x” |
  • | 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 |
  • | 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.
  • | Create an unordered multi-line list | of items. |
  • | 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. |
  • | 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. |
  • | 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 an amount denoted in full coins. | E.g. “0.0034” supplied on the command | line. * |
  • | 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. |
  • | 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. |
  • | 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. |
  • | 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. |
  • | Helper function for ParseFixedPoint |
  • | 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 | | The string to sanitize | ––––– | @param[in] rule | | The set of safe chars to choose (default: | least restrictive) | | ———– | @return | | A new string without unsafe chars |
  • | Timing-attack-resistant comparison. | | Takes time proportional to length of | first argument. |
  • | 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. |
  • | Locale-independent version of std::to_string |
  • | Mark a bilingual_str as untranslated |
  • | Check if a string does not contain any | embedded NUL (\0) characters |