aboutsummaryrefslogtreecommitdiff
path: root/src/util/string.h
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-08-06 21:51:57 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-08-06 22:08:24 +0300
commit77a90f03acd551bcc538f6728939cc2ed8c6a3c4 (patch)
tree9901e842354ac2450b6b7ba724c208089efae8f9 /src/util/string.h
parent6a5ccd65c704253b7442b54064f5ba281c34fd26 (diff)
refactor: Move MakeUnorderedList into util/string.h to make it reusable
Diffstat (limited to 'src/util/string.h')
-rw-r--r--src/util/string.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/string.h b/src/util/string.h
index b26facc502..5617e4acc1 100644
--- a/src/util/string.h
+++ b/src/util/string.h
@@ -65,6 +65,14 @@ inline std::string Join(const std::vector<std::string>& list, const std::string&
}
/**
+ * Create an unordered multi-line list of items.
+ */
+inline std::string MakeUnorderedList(const std::vector<std::string>& items)
+{
+ return Join(items, "\n", [](const std::string& item) { return "- " + item; });
+}
+
+/**
* Check if a string does not contain any embedded NUL (\0) characters
*/
[[nodiscard]] inline bool ValidAsCString(const std::string& str) noexcept