RSTools 3.1.0
Versatile C++20 utility library
Loading...
Searching...
No Matches
Trim.hpp File Reference
#include <string>
#include <string_view>

Go to the source code of this file.

Namespaces

namespace  RST
 Root namespace of RSTools.
 
namespace  RST::String
 String helpers: case, trimming, splitting, joining, replacing, parsing and hashing.
 

Trimming

These functions remove chars, whitespace by default, from both ends of a string, or only from the left (l) or right (r) end.

View functions return a view without copying; the others trim in place or return a Copy.

constexpr std::string_view RST::String::Whitespace = " \t\n\r\f\v"
 Characters trimmed by default: space, tab, line feed, carriage return, form feed and vertical tab.
 
constexpr std::string_view RST::String::ltrimView (std::string_view str, std::string_view chars=Whitespace) noexcept
 
constexpr std::string_view RST::String::rtrimView (std::string_view str, std::string_view chars=Whitespace) noexcept
 
constexpr std::string_view RST::String::trimView (std::string_view str, std::string_view chars=Whitespace) noexcept
 
void RST::String::trim (std::string &str, std::string_view chars=Whitespace)
 
void RST::String::ltrim (std::string &str, std::string_view chars=Whitespace)
 
void RST::String::rtrim (std::string &str, std::string_view chars=Whitespace)
 
std::string RST::String::trimCopy (std::string_view str, std::string_view chars=Whitespace)
 
std::string RST::String::ltrimCopy (std::string_view str, std::string_view chars=Whitespace)
 
std::string RST::String::rtrimCopy (std::string_view str, std::string_view chars=Whitespace)