polybar-dwm/include/utils/string.hpp

32 lines
1.0 KiB
C++
Raw Normal View History

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