2020-06-23 18:07:00 +00:00
|
|
|
//
|
|
|
|
// StringUtil.h
|
|
|
|
//
|
|
|
|
// Low-level string functions.
|
|
|
|
// Convert characters to Unicode, upper-/lowercase conversion, string formatting etc.
|
|
|
|
//
|
|
|
|
|
2017-11-15 15:59:39 +00:00
|
|
|
#pragma once
|
2017-11-22 21:29:52 +00:00
|
|
|
#ifndef ES_CORE_UTILS_STRING_UTIL_H
|
|
|
|
#define ES_CORE_UTILS_STRING_UTIL_H
|
2017-11-15 15:59:39 +00:00
|
|
|
|
|
|
|
#include <string>
|
2018-01-26 18:53:19 +00:00
|
|
|
#include <vector>
|
2017-11-15 15:59:39 +00:00
|
|
|
|
|
|
|
namespace Utils
|
|
|
|
{
|
2020-06-23 18:07:00 +00:00
|
|
|
namespace String
|
|
|
|
{
|
|
|
|
typedef std::vector<std::string> stringVector;
|
2018-01-26 18:53:19 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
unsigned int chars2Unicode(const std::string& _string, size_t& _cursor);
|
|
|
|
std::string unicode2Chars(const unsigned int _unicode);
|
|
|
|
size_t nextCursor(const std::string& _string, const size_t _cursor);
|
|
|
|
size_t prevCursor(const std::string& _string, const size_t _cursor);
|
|
|
|
size_t moveCursor(const std::string& _string, const size_t _cursor, const int _amount);
|
|
|
|
std::string toLower(const std::string& _string);
|
|
|
|
std::string toUpper(const std::string& _string);
|
|
|
|
std::string trim(const std::string& _string);
|
|
|
|
std::string replace(const std::string& _string, const std::string& _replace,
|
|
|
|
const std::string& _with);
|
|
|
|
bool startsWith(const std::string& _string, const std::string& _start);
|
|
|
|
bool endsWith(const std::string& _string, const std::string& _end);
|
|
|
|
std::string removeParenthesis(const std::string& _string);
|
|
|
|
stringVector delimitedStringToVector(const std::string& _string,
|
|
|
|
const std::string& _delimiter, bool sort = false);
|
|
|
|
stringVector commaStringToVector(const std::string& _string, bool sort = false);
|
|
|
|
std::string vectorToCommaString(stringVector _vector);
|
|
|
|
std::string format(const char* _string, ...);
|
|
|
|
std::string scramble(const std::string& _input, const std::string& key);
|
2017-11-15 15:59:39 +00:00
|
|
|
|
2020-06-23 18:07:00 +00:00
|
|
|
} // String::
|
2017-11-15 15:59:39 +00:00
|
|
|
|
|
|
|
} // Utils::
|
|
|
|
|
2017-11-22 21:29:52 +00:00
|
|
|
#endif // ES_CORE_UTILS_STRING_UTIL_H
|