12template<
typename T>
bool Contains(
const std::vector<T> &toSearch,
const T &
object) {
return std::find(toSearch.cbegin(), toSearch.cend(),
object) != toSearch.cend(); }
14template<
typename T>
void AppendTo(std::vector<T> &a,
const std::vector<T> &b) { a.insert(a.end(), b.begin(), b.end()); }
16template<
typename T> std::vector<T>
Slice(
const std::vector<T> &a,
int from,
int to = -1) {
return std::vector<T>(a.begin() + from, to < 0 ? a.end() : a.begin() + to); }
18template<
typename T> vector<T>
Filter(
const std::vector<T> &v, std::function<
bool(
const T&)> f) {
20 std::copy_if(v.begin(), v.end(), std::back_inserter(v2), f);
24template<
typename T>
bool BeginsWith(
const T &str,
const T &match) {
25 return str.size() >= match.size() && equal(match.begin(), match.end(), str.begin());
33COMMON_API std::vector<std::string>
Split(std::string str,
const std::string &delimeter);
34COMMON_API std::string
Join(
const std::vector<std::string> &parts,
const std::string &delimeter);
35COMMON_API std::string
ReplaceAll(std::string source,
const std::string &oldSegment,
const std::string &newSegment);
COMMON_API bool ContainsIgnoreCase(const std::string &toSearch, const std::string &query)
vector< T > Filter(const std::vector< T > &v, std::function< bool(const T &)> f)
COMMON_API std::string ReplaceAll(std::string source, const std::string &oldSegment, const std::string &newSegment)
std::vector< T > Slice(const std::vector< T > &a, int from, int to=-1)
COMMON_API std::string ToLower(std::string str)
bool BeginsWith(const T &str, const T &match)
COMMON_API std::string Join(const std::vector< std::string > &parts, const std::string &delimeter)
bool Contains(const std::vector< T > &toSearch, const T &object)
COMMON_API std::vector< std::string > Split(std::string str, const std::string &delimeter)
void AppendTo(std::vector< T > &a, const std::vector< T > &b)
COMMON_API bool EndsWith(const std::string &str, const std::string &match)