Changeset View
Changeset View
Standalone View
Standalone View
src/utilstrencodings.h
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
void SplitHostPort(std::string in, int &portOut, std::string &hostOut); | void SplitHostPort(std::string in, int &portOut, std::string &hostOut); | ||||
std::string i64tostr(int64_t n); | std::string i64tostr(int64_t n); | ||||
std::string itostr(int n); | std::string itostr(int n); | ||||
int64_t atoi64(const char *psz); | int64_t atoi64(const char *psz); | ||||
int64_t atoi64(const std::string &str); | int64_t atoi64(const std::string &str); | ||||
int atoi(const std::string &str); | int atoi(const std::string &str); | ||||
/** | /** | ||||
* 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 | |||||
*/ | |||||
constexpr inline bool IsSpace(char c) noexcept { | |||||
return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || | |||||
c == '\v'; | |||||
} | |||||
/** | |||||
* Convert string to signed 32-bit integer with strict parse error feedback. | * Convert string to signed 32-bit integer with strict parse error feedback. | ||||
* @returns true if the entire string could be parsed as valid integer, false if | * @returns 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. | * not the entire string could be parsed or when overflow or underflow occurred. | ||||
*/ | */ | ||||
bool ParseInt32(const std::string &str, int32_t *out); | bool ParseInt32(const std::string &str, int32_t *out); | ||||
/** | /** | ||||
* Convert string to signed 64-bit integer with strict parse error feedback. | * Convert string to signed 64-bit integer with strict parse error feedback. | ||||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |