lintel 0.2.0
Loading...
Searching...
No Matches
StringUtils.h
Go to the documentation of this file.
1#ifndef LINTEL_STRINGUTILS_H
2#define LINTEL_STRINGUTILS_H
3
4#include <string>
5#include <string_view>
6#include <vector>
7
8namespace lintel {
13{
14public:
15 StringUtils() = delete;
16
18
20
27 static std::vector<std::string> split(const std::string &s, char delimiter);
28
33 static constexpr bool startsWith(std::string_view s, std::string_view start)
34 {
35 return s.size() >= start.size() && s.compare(0, start.size(), start) == 0;
36 }
37
42 static constexpr bool endsWith(std::string_view s, std::string_view end)
43 {
44 return s.size() >= end.size() && s.compare(s.size() - end.size(), end.size(), end) == 0;
45 }
46
52 static std::string replaceAll(const std::string &s, std::string &&replace, std::string &&with);
53};
54
55}// namespace lintel
56#endif// LINTEL_STRINGUTILS_H
Definition StringUtils.h:13
static constexpr bool endsWith(std::string_view s, std::string_view end)
Definition StringUtils.h:42
static constexpr bool startsWith(std::string_view s, std::string_view start)
Definition StringUtils.h:33
StringUtils(StringUtils &)=delete
static std::vector< std::string > split(const std::string &s, char delimiter)
StringUtils(StringUtils &&)=delete
static std::string replaceAll(const std::string &s, std::string &&replace, std::string &&with)
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9