39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace ddkit {
|
|
namespace utils {
|
|
namespace string {
|
|
|
|
bool beginsWith(const std::string& text, const std::string& prefix);
|
|
bool endsWith(const std::string& text, const std::string& suffix);
|
|
bool contains(const std::string& container, const std::string& containee);
|
|
|
|
void removePrefix(std::string& line, const std::string& prefix);
|
|
void removePrefixIf(std::string& line, const std::string& prefix);
|
|
void removeSuffix(std::string& line, const std::string& suffix);
|
|
void removeSuffixIf(std::string& line, const std::string& suffix);
|
|
|
|
std::string trimLeft(const std::string& text);
|
|
std::string trimRight(const std::string& text);
|
|
std::string trim(const std::string& text);
|
|
|
|
std::string toLower(const std::string& text);
|
|
std::string toUpper(const std::string& text);
|
|
std::string toFirstUpper(const std::string& text);
|
|
|
|
std::string replace(std::string text, const std::string& from, const std::string& to);
|
|
std::vector<std::string> split(const std::string& text, char delim);
|
|
std::string join(const std::vector<std::string>&, const std::string& delimiter);
|
|
|
|
bool isInt(const std::string& text);
|
|
int toInt(const std::string& text);
|
|
bool isInt64(const std::string& text);
|
|
int64_t toInt64(const std::string& text);
|
|
|
|
} // namespace string
|
|
} // namespace utils
|
|
} // namespace ddkit
|