2016-05-30 23:58:58 -04:00
|
|
|
#pragma once
|
2016-05-19 10:41:06 -04:00
|
|
|
|
2016-06-14 23:32:35 -04:00
|
|
|
#include <sstream>
|
2016-05-19 10:41:06 -04:00
|
|
|
|
2016-06-14 23:32:35 -04:00
|
|
|
#include "common.hpp"
|
2016-05-19 10:41:06 -04:00
|
|
|
|
2016-06-14 23:32:35 -04:00
|
|
|
LEMONBUDDY_NS
|
2016-05-19 10:41:06 -04:00
|
|
|
|
2016-06-14 23:32:35 -04:00
|
|
|
namespace string_util {
|
2016-10-29 00:48:51 -04:00
|
|
|
/**
|
|
|
|
* Hash type
|
|
|
|
*/
|
|
|
|
using hash_type = unsigned long;
|
|
|
|
|
2016-11-02 15:22:45 -04:00
|
|
|
bool contains(const string& haystack, const string& needle);
|
|
|
|
string upper(const string& s);
|
|
|
|
string lower(const string& s);
|
|
|
|
bool compare(const string& s1, const string& s2);
|
|
|
|
string replace(const string& haystack, string needle, string replacement);
|
|
|
|
string replace_all(const string& haystack, string needle, string replacement);
|
|
|
|
string squeeze(const string& haystack, char needle);
|
|
|
|
string strip(const string& haystack, char needle);
|
|
|
|
string strip_trailing_newline(const string& haystack);
|
|
|
|
string ltrim(const string& haystack, char needle);
|
|
|
|
string rtrim(const string& haystack, char needle);
|
|
|
|
string trim(const string& haystack, char needle);
|
|
|
|
string join(vector<string> strs, string delim);
|
|
|
|
vector<string>& split_into(string s, char delim, vector<string>& container);
|
|
|
|
vector<string> split(const string& s, char delim);
|
|
|
|
size_t find_nth(string haystack, size_t pos, string needle, size_t nth);
|
2016-11-13 00:09:51 -05:00
|
|
|
string floatval(float value, int decimals = 2, bool fixed = false, string locale = "");
|
|
|
|
string filesize(unsigned long long bytes, int decimals = 2, bool fixed = false, string locale = "");
|
2016-11-02 15:22:45 -04:00
|
|
|
string from_stream(const std::basic_ostream<char>& os);
|
|
|
|
hash_type hash(string src);
|
2016-05-19 10:41:06 -04:00
|
|
|
}
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
LEMONBUDDY_NS_END
|