2022-09-19 07:34:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace ppc::str {
|
2022-09-21 06:37:50 +00:00
|
|
|
std::vector<std::string> split(const std::string &splittable, std::initializer_list<char> splitters, bool remove_empty_entries = false);
|
2022-09-19 07:34:19 +00:00
|
|
|
std::string trim(std::string splittable, std::initializer_list<char> splitters = { ' ', '\n', '\t', '\r' });
|
2022-09-21 06:37:50 +00:00
|
|
|
inline bool begins_with(const std::string &str, const std::string &other) {
|
2022-09-19 07:34:19 +00:00
|
|
|
return !str.find(other);
|
|
|
|
}
|
2022-09-21 06:37:50 +00:00
|
|
|
inline bool ends_with(const std::string &str, const std::string &other) {
|
2022-09-19 07:34:19 +00:00
|
|
|
return str.find_last_of(other) == (str.length() - other.length());
|
|
|
|
}
|
|
|
|
}
|