#include <iostream>
int main(int argc, char** argv)
{
std::string str;
str = "a foo a bar a baz";
std::cout << str << std::endl;
str = "a foo a bar a baz";
std::cout << str << std::endl;
str = "a foo a bar a baz";
std::cout << str << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("true") << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("yes") << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("on") << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("1") << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("false") << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("no") << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("off") << std::endl;
std::cout << CppCommon::StringUtils::FromString<bool>("0") << std::endl;
std::cout << CppCommon::StringUtils::FromString<char>("0") << std::endl;
std::cout << CppCommon::StringUtils::FromString<uint8_t>("49") << std::endl;
std::cout << CppCommon::StringUtils::FromString<int>("100") << std::endl;
std::cout << CppCommon::StringUtils::FromString<double>("123.456") << std::endl;
return 0;
}
static size_t CountAll(std::string_view str, std::string_view substr)
Count all occurrences of substring.
static std::vector< std::string > Split(std::string_view str, char delimiter, bool skip_empty=false)
Split the string into tokens by the given delimiter character.
static std::string ToRTrim(std::string_view str)
Trims space characters from the end of the given constant string.
static std::string ToString(const T &value)
Converts arbitrary datatypes into string using std::ostringstream.
static bool ReplaceAll(std::string &str, std::string_view substr, std::string_view with)
Replace all occurrences of substring with another substring.
static std::string ToLTrim(std::string_view str)
Trims space characters from the start of the given constant string.
static std::string Join(const std::vector< std::string > &tokens, bool skip_empty=false, bool skip_blank=false)
Join tokens into the string.
static char ToLower(char ch)
Convert the given character to lower case.
static bool ReplaceFirst(std::string &str, std::string_view substr, std::string_view with)
Replace the first occurrence of substring with another substring.
static std::string ToTrim(std::string_view str)
Trims space characters from the both sides of the given constant string.
static char ToUpper(char ch)
Convert the given character to UPPER case.
static bool ReplaceLast(std::string &str, std::string_view substr, std::string_view with)
Replace the last occurrence of substring with another substring.
static bool Contains(std::string_view str, const char ch)
Is the given string contains the given character?
static std::string RemoveBlank(std::string_view str)
Remove blank characters from the given string.
String utilities definition.