LIPH's C++ Codes
string.h File Reference
#include <optional>
#include <sstream>
#include <string>
#include <string_view>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  liph
 

Functions

std::string_view liph::ltrim (std::string_view s, std::string_view charset)
 
std::string_view liph::rtrim (std::string_view s, std::string_view charset)
 
std::string_view liph::trim (std::string_view s, std::string_view charset)
 
constexpr bool liph::startswith (std::string_view s, std::string_view t) noexcept
 
constexpr bool liph::endswith (std::string_view s, std::string_view t) noexcept
 
std::string liph::replace (std::string_view str, std::string_view old, std::string_view New)
 Replace all @old in @str with @New. More...
 
void liph::split (std::vector< std::string > &tokens, const std::string &s, const std::string &delimiters=" ")
 Split @s to tokens by @delimiters and append to @tokens. More...
 
std::vector< std::string > liph::split (const std::string &s, const std::string &delimiters=" ")
 Split @s to tokens by @delimiters and return. More...
 
std::string liph::basename (std::string_view path)
 Return basename of @path. More...
 
std::string liph::dirname (std::string_view path)
 Return dirname of @path. More...
 
template<typename Target = std::string, typename Source = std::string>
Target liph::to (const Source &s)
 Convert source to target. More...
 
void liph::skip_whitespace (std::string_view &sv)
 @sv skips leading whitespace characters and be the substr More...
 
bool liph::eat_symbol (std::string_view &sv, std::string_view symbol)
 
std::optional< int > liph::to_int (std::string_view str)
 Convert @str to int. More...
 
template<std::ranges::input_range Range>
std::string liph::join (const Range &range, const std::string &sep=" ")
 Join all items in @range into a string, using @sep as separator. More...