26#ifndef ROUTER_SRC_MYSQL_REST_SERVICE_INCLUDE_HELPER_STRING_TRIM_H_
27#define ROUTER_SRC_MYSQL_REST_SERVICE_INCLUDE_HELPER_STRING_TRIM_H_
35inline void left(std::string *to_trim) {
36 std::size_t pos = to_trim->find_first_not_of(
" ");
38 to_trim->erase(0, pos);
41inline void right(std::string *to_trim) {
42 auto size = to_trim->length();
44 if ((*to_trim)[
size - 1] !=
' ')
break;
47 if (
size == to_trim->length())
return;
52inline void trim(std::string *to_trim) {
57inline std::string
make_left(
const std::string &to_trim) {
58 std::size_t pos = to_trim.find_first_not_of(
" ");
60 if (std::string::npos == pos)
return {};
62 return to_trim.substr(pos);
65inline std::string
make_right(
const std::string &to_trim) {
66 auto size = to_trim.length();
68 if (to_trim[
size - 1] !=
' ')
break;
71 if (
size == to_trim.length())
return to_trim;
73 if (0 ==
size)
return {};
75 return to_trim.substr(0,
size);
78inline std::string
make_trim(
const std::string &to_trim) {
Some integer typedefs for easier portability.
std::string make_trim(const std::string &to_trim)
Definition: trim.h:78
std::string make_right(const std::string &to_trim)
Definition: trim.h:65
void trim(std::string *to_trim)
Definition: trim.h:52
void right(std::string *to_trim)
Definition: trim.h:41
std::string make_left(const std::string &to_trim)
Definition: trim.h:57
void left(std::string *to_trim)
Definition: trim.h:35
size_t size(const char *const c)
Definition: base64.h:46