polybar-dwm/include/utils/string.hpp
Michael Carlberg 39d3f61497 refactor(core): Clean-up
- use "#pragma once" instead of the regular include guard
- fix errors and warnings reported by cppcheck
2016-06-02 01:32:06 +02:00

32 lines
1.2 KiB
C++

#pragma once
#include <string>
#include <vector>
namespace string
{
bool compare(const std::string& s1, const std::string& s2);
// std::string upper(const std::string& s);
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);
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);
}