We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent df5f761 commit 5e95143Copy full SHA for 5e95143
fable/include/fable/utility/string.hpp
@@ -20,12 +20,23 @@
20
* \see fable/utility/string.cpp
21
*/
22
23
+#pragma once
24
+
25
#include <string> // for string
26
#include <string_view> // for string_view
27
#include <vector> // for vector<>
28
29
namespace fable {
30
31
+inline bool starts_with(std::string_view s, std::string_view prefix) {
32
+ return s.size() >= prefix.size() && s.compare(0, prefix.size(), prefix) == 0;
33
+}
34
35
+inline bool ends_with(std::string_view s, std::string_view suffix) {
36
+ return s.size() >= suffix.size() &&
37
+ s.compare(s.size() - suffix.size(), std::string::npos, suffix) == 0;
38
39
40
std::string join_vector(const std::vector<std::string>& v, std::string_view sep);
41
42
/**
0 commit comments