46 using std::string::string;
51 using std::string::operator =;
62 string (
const string & other ) =
default;
67 string (
string && other ) =
default;
85 explicit string (
const std::string & other ) noexcept : std::string ( other ) {
94 explicit string ( std::string && other ) noexcept : std::string ( std::move ( other ) ) {
104 static_cast < std::string &
> ( * this ) = std::move ( other );
115 static_cast < std::string &
> ( * this ) = other;
130template <
typename T >
147template <
typename T >
159std::string
from_string (
const std::string & value );
203long long from_string (
const std::string & value );
225unsigned long from_string (
const std::string & value );
236unsigned long long from_string (
const std::string & value );
269std::string
implode (
const std::vector < std::string > & source,
const std::string & delimiter );
303inline std::string_view
ltrim ( std::string_view s ) {
304 const auto * endPos = std::find_if ( s.begin ( ), s.end ( ),
not_isspace );
305 s.remove_prefix ( std::distance ( s.begin ( ), endPos ) );
317inline std::string_view
rtrim ( std::string_view s ) {
318 const auto * beginPos = std::find_if ( s.rbegin ( ), s.rend ( ),
not_isspace ).base ( );
319 s.remove_suffix ( std::distance ( beginPos, s.end ( ) ) );
331inline std::string_view
trim ( std::string_view s ) {
338 return std::string_view { (
begin !=
end ) ? & *
begin :
nullptr,
static_cast < std::string_view::size_type
> (
std::max ( std::distance (
begin,
end ),
static_cast < typename std::string_view::difference_type
> ( 0 ) ) ) };
std::string str() const &
Definition: sstream.cpp:29
string(const std::string &other) noexcept
Constructor from standard string.
Definition: string.hpp:85
string & operator=(string &&other)=default
string(std::string &&other) noexcept
Constructor from standard string.
Definition: string.hpp:94
string(string &&other)=default
string(const string &other)=default
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: sigHandler.cpp:20
std::string from_string(const std::string &value)
Predeclaration of from string method. The from string methods are supposed to convert string represen...
Definition: string.cpp:13
auto end(Container &&cont) -> decltype(std::forward(cont).end())
Definition: iterator.hpp:912
bool not_isspace(int ch)
Inverse of isspace method.
Definition: string.hpp:291
std::string_view make_string_view(std::string::const_iterator begin, std::string::const_iterator end)
Definition: string.hpp:337
std::string_view trim(std::string_view s)
Trims spaces inside the string from both sides.
Definition: string.hpp:331
constexpr const T & max(const T &a)
Root case of maximum computation. The maximum from one value is the value itself.
Definition: algorithm.hpp:278
std::string implode(const std::vector< std::string > &source, const std::string &delimiter)
Merges strings using the delimiter.
Definition: string.cpp:76
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
std::string_view rtrim(std::string_view s)
Trims spaces inside the string from the right.
Definition: string.hpp:317
ext::vector< std::string > explode(const std::string &source, const std::string &delimiter)
Splits the string to substrings based on delimiter.
Definition: string.cpp:61
std::string_view ltrim(std::string_view s)
Trims spaces inside the string from the left.
Definition: string.hpp:303
bool isspace(int ch)
isspace method.
Definition: string.hpp:279
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
Definition: RandomStringFactory.cpp:12