General Utility Library for C++17 25.4.1
trim.h
Go to the documentation of this file.
1
24#ifndef GUL17_TRIM_H_
25#define GUL17_TRIM_H_
26
27#include <string_view>
28
29#include "gul17/internal.h"
30#include "gul17/string_util.h"
31
32namespace gul17 {
33
57GUL_EXPORT
58std::string trim(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
59
77GUL_EXPORT
78std::string_view trim_sv(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
79
97GUL_EXPORT
98std::string trim_left(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
99
117GUL_EXPORT
118std::string_view trim_left_sv(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
119
137GUL_EXPORT
138std::string trim_right(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
139
157GUL_EXPORT
158std::string_view trim_right_sv(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
159
160// TODO: Add trim_*_inplace
161
163
164} // namespace gul17
165
166
173#endif
auto constexpr bit_set(unsigned bit) noexcept -> ReturnT
Set a bit in an integral type.
Definition bit_manip.h:121
GUL_EXPORT const std::string_view default_whitespace_characters
The default characters that are treated as whitespace by GUL.
Definition string_util.cc:29
GUL_EXPORT std::string_view trim_sv(std::string_view str, std::string_view ws_chars=default_whitespace_characters)
Trim leading and trailing whitespace (or a custom set of characters) from a string,...
Definition trim.cc:34
GUL_EXPORT std::string trim(std::string_view str, std::string_view ws_chars=default_whitespace_characters)
Trim leading and trailing whitespace (or a custom set of characters) from a string,...
Definition trim.cc:29
GUL_EXPORT std::string trim_right(std::string_view str, std::string_view ws_chars=default_whitespace_characters)
Trim trailing whitespace (or a custom set of characters) from a string, returning a new std::string.
Definition trim.cc:61
GUL_EXPORT std::string_view trim_right_sv(std::string_view str, std::string_view ws_chars=default_whitespace_characters)
Trim trailing whitespace (or a custom set of characters) from a string, returning a view into the ori...
Definition trim.cc:66
GUL_EXPORT std::string trim_left(std::string_view str, std::string_view ws_chars=default_whitespace_characters)
Trim leading whitespace (or a custom set of characters) from a string, returning a new std::string.
Definition trim.cc:46
GUL_EXPORT std::string_view trim_left_sv(std::string_view str, std::string_view ws_chars=default_whitespace_characters)
Trim leading whitespace (or a custom set of characters) from a string, returning a view into the orig...
Definition trim.cc:51
Definition of macros used internally by GUL.
Namespace gul17 contains all functions and classes of the General Utility Library.
Definition doxygen.h:26
Declaration of string utility functions.