General Utility Library for C++17 26.5.0
trim.h
Go to the documentation of this file.
1
27#ifndef GUL17_TRIM_H_
28#define GUL17_TRIM_H_
29
30#include <string_view>
31
32#include "gul17/internal.h"
33#include "gul17/string_util.h"
34
35namespace gul17 {
36
60GUL_EXPORT
61std::string trim(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
62
80GUL_EXPORT
81std::string_view trim_sv(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
82
100GUL_EXPORT
101std::string trim_left(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
102
120GUL_EXPORT
121std::string_view trim_left_sv(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
122
140GUL_EXPORT
141std::string trim_right(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
142
160GUL_EXPORT
161std::string_view trim_right_sv(std::string_view str, std::string_view ws_chars = default_whitespace_characters);
162
163// TODO: Add trim_*_inplace
164
166
167} // namespace gul17
168
169
176#endif
auto constexpr bit_set(unsigned bit) noexcept -> ReturnT
Set a bit in an integral type.
Definition bit_manip.h:124
GUL_EXPORT const std::string_view default_whitespace_characters
The default characters that are treated as whitespace by GUL.
Definition string_util.cc:32
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:37
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:32
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:64
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:69
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:49
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:54
Definition of macros used internally by GUL.
Namespace gul17 contains all functions and classes of the General Utility Library.
Definition doxygen.h:29
Declaration of string utility functions.