tgbotxx  1.1.6.9
Telegram Bot C++ Library
StringUtils.hpp File Reference
#include <algorithm>
#include <random>
#include <span>
#include <sstream>
#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

 tgbotxx
 
 tgbotxx::StringUtils
 Namespace contains useful string related utility functions.
 

Functions

template<typename T , typename D >
static std::string tgbotxx::StringUtils::join (const std::span< T > &con, const D &delim)
 Form a string from a container with a delimiter. More...
 
template<typename T , typename D >
static std::string tgbotxx::StringUtils::join (const std::vector< T > &con, const D &delim)
 
static std::vector< std::string > tgbotxx::StringUtils::split (const std::string &str, char delim)
 Split a string by delimiter. More...
 
static std::string tgbotxx::StringUtils::toLowerCopy (std::string str)
 Lowercase a string. More...
 
static void tgbotxx::StringUtils::toLower (std::string &str)
 Lowercase original string str. More...
 
static std::string tgbotxx::StringUtils::toUpperCopy (std::string str)
 Uppercase a string. More...
 
static void tgbotxx::StringUtils::toUpper (std::string &str)
 Uppercase original string str. More...
 
static void tgbotxx::StringUtils::ltrim (std::string &str)
 Left trim a string from start (in place) More...
 
static void tgbotxx::StringUtils::rtrim (std::string &str)
 Right trim a string from end (in place) More...
 
static void tgbotxx::StringUtils::trim (std::string &str)
 Left and right trim a string (from beginning and end) (in place) More...
 
static std::string tgbotxx::StringUtils::ltrimCopy (std::string s)
 Left trim a string from start (copy) More...
 
static std::string tgbotxx::StringUtils::rtrimCopy (std::string s)
 Right trim a string from end (copy) More...
 
static std::string tgbotxx::StringUtils::trimCopy (std::string s)
 Left and Right trim a string from start and end (copy) More...
 
static bool tgbotxx::StringUtils::startsWith (const std::string &str, const std::string &prefix, bool ignoreCase=false)
 Returns true if str starts with prefix. More...
 
static bool tgbotxx::StringUtils::endsWith (const std::string &str, const std::string &suffix, bool ignoreCase=false)
 Returns true if str ends with suffix. More...
 
static void tgbotxx::StringUtils::replace (std::string &str, const std::string &search, const std::string &replace)
 
static std::string tgbotxx::StringUtils::replaceCopy (std::string str, const std::string &search, const std::string &replace)
 
template<typename T >
static T tgbotxx::StringUtils::to (const std::string &str)
 
static std::string tgbotxx::StringUtils::random (std::size_t length)
 Returns a random string of length characters. More...