summaryrefslogtreecommitdiff
path: root/src/str.hh
blob: c736f4bf645c453fe56a9df8c87787607dd32f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef STR_HH
#define STR_HH

#include <string_view>
#include <vector>

namespace str {

void split(std::string_view str, std::vector<std::string_view>& out,
           char separator = ' ', bool keep_empty = false);

[[nodiscard]] std::vector<std::string_view> split(std::string_view str,
                                                  char separator = ' ',
                                                  bool keep_empty = false);

void split(std::string_view str, std::vector<std::string_view>& out,
           std::string_view separator, bool keep_empty = false);

[[nodiscard]] std::vector<std::string_view> split(std::string_view str,
                                                  std::string_view separator,
                                                  bool keep_empty = false);

[[nodiscard]]
std::string_view trim(std::string_view str);

[[nodiscard]]
std::string_view ltrim(std::string_view str);

[[nodiscard]]
std::string_view rtrim(std::string_view str);

}  // namespace str

#endif  // STR_HH