polybar-dwm/include/utils/string.hpp

32 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
2016-05-19 14:41:06 +00:00
#include <string>
#include <vector>
namespace string
{
bool compare(const std::string& s1, const std::string& s2);
// std::string upper(const std::string& s);
2016-05-19 14:41:06 +00:00
std::string lower(const std::string& s);
std::string replace(const std::string& haystack, const std::string& needle, const std::string& replacement);
std::string replace_all(const std::string& haystack, const std::string& needle, const std::string& replacement);
std::string squeeze(const std::string& haystack, const char &needle);
// std::string strip(const std::string& haystack, const char &needle);
2016-05-19 14:41:06 +00:00
std::string strip_trailing_newline(const std::string& s);
std::string trim(const std::string& haystack, const char &needle);
std::string ltrim(const std::string& haystack, const char &needle);
std::string rtrim(const std::string& haystack, const char &needle);
std::string join(const std::vector<std::string> &strs, const std::string& delim);
std::vector<std::string> split(const std::string& s, const char &delim);
std::vector<std::string> &split_into(const std::string& s, const char &delim, std::vector<std::string> &elems);
std::size_t find_nth(const std::string& haystack, std::size_t pos, const std::string& needle, std::size_t nth);
}