Changeset View
Changeset View
Standalone View
Standalone View
src/util/strencodings.h
Show First 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | bool ConvertBits(const O &outfn, I it, I end) { | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Converts the given character to its lowercase equivalent. | * Converts the given character to its lowercase equivalent. | ||||
* This function is locale independent. It only converts uppercase | * This function is locale independent. It only converts uppercase | ||||
* characters in the standard 7-bit ASCII range. | * characters in the standard 7-bit ASCII range. | ||||
* This is a feature, not a limitation. | |||||
* | |||||
* @param[in] c the character to convert to lowercase. | * @param[in] c the character to convert to lowercase. | ||||
* @return the lowercase equivalent of c; or the argument | * @return the lowercase equivalent of c; or the argument | ||||
* if no conversion is possible. | * if no conversion is possible. | ||||
*/ | */ | ||||
constexpr char ToLower(char c) { | constexpr char ToLower(char c) { | ||||
return (c >= 'A' && c <= 'Z' ? (c - 'A') + 'a' : c); | return (c >= 'A' && c <= 'Z' ? (c - 'A') + 'a' : c); | ||||
} | } | ||||
/** | /** | ||||
* Converts the given string to its lowercase equivalent. | * Returns the lowercase equivalent of the given string. | ||||
* This function is locale independent. It only converts uppercase | * This function is locale independent. It only converts uppercase | ||||
* characters in the standard 7-bit ASCII range. | * characters in the standard 7-bit ASCII range. | ||||
* @param[in,out] str the string to convert to lowercase. | * This is a feature, not a limitation. | ||||
* | |||||
* @param[in] str the string to convert to lowercase. | |||||
* @returns lowercased equivalent of str | |||||
*/ | */ | ||||
void Downcase(std::string &str); | std::string ToLower(const std::string &str); | ||||
/** | /** | ||||
* Converts the given character to its uppercase equivalent. | * Converts the given character to its uppercase equivalent. | ||||
* This function is locale independent. It only converts lowercase | * This function is locale independent. It only converts lowercase | ||||
* characters in the standard 7-bit ASCII range. | * characters in the standard 7-bit ASCII range. | ||||
* This is a feature, not a limitation. | |||||
* | |||||
* @param[in] c the character to convert to uppercase. | * @param[in] c the character to convert to uppercase. | ||||
* @return the uppercase equivalent of c; or the argument | * @return the uppercase equivalent of c; or the argument | ||||
* if no conversion is possible. | * if no conversion is possible. | ||||
*/ | */ | ||||
constexpr char ToUpper(char c) { | constexpr char ToUpper(char c) { | ||||
return (c >= 'a' && c <= 'z' ? (c - 'a') + 'A' : c); | return (c >= 'a' && c <= 'z' ? (c - 'a') + 'A' : c); | ||||
} | } | ||||
/** | /** | ||||
* Returns the uppercase equivalent 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 convert to uppercase. | |||||
* @returns UPPERCASED EQUIVALENT OF str | |||||
*/ | |||||
std::string ToUpper(const std::string &str); | |||||
/** | |||||
* Capitalizes the first character of the given string. | * Capitalizes the first character of the given string. | ||||
* This function is locale independent. It only capitalizes the | * This function is locale independent. It only converts lowercase | ||||
* first character of the argument if it has an uppercase equivalent | * characters in the standard 7-bit ASCII range. | ||||
* in the standard 7-bit ASCII range. | * This is a feature, not a limitation. | ||||
* | |||||
* @param[in] str the string to capitalize. | * @param[in] str the string to capitalize. | ||||
* @return string with the first letter capitalized. | * @returns string with the first letter capitalized. | ||||
*/ | */ | ||||
std::string Capitalize(std::string str); | std::string Capitalize(std::string str); | ||||
#endif // BITCOIN_UTIL_STRENCODINGS_H | #endif // BITCOIN_UTIL_STRENCODINGS_H |