2015-07-26 21:39:49 +00:00
|
|
|
#ifndef STRINGUTIL_H
|
|
|
|
#define STRINGUTIL_H
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <string>
|
|
|
|
typedef std::list<std::string> CStringList;
|
|
|
|
|
|
|
|
namespace StringUtil
|
|
|
|
{
|
|
|
|
std::string GetFileDirectory(std::string path);
|
|
|
|
std::string GetFileName(std::string path);
|
|
|
|
std::string GetFileNameWithExtension(std::string path);
|
|
|
|
std::string GetPathWithoutExtension(std::string path);
|
|
|
|
std::string GetExtension(std::string path);
|
|
|
|
std::string ToUpper(std::string str);
|
|
|
|
std::string ToLower(std::string str);
|
2015-09-18 05:53:53 +00:00
|
|
|
std::string ToHexString(unsigned char num, bool addPrefix = true, bool uppercase = false, int width = 0);
|
|
|
|
std::string ToHexString(unsigned short num, bool addPrefix = true, bool uppercase = false, int width = 0);
|
|
|
|
std::string ToHexString(unsigned long num, bool addPrefix = true, bool uppercase = false, int width = 0);
|
2015-07-26 21:39:49 +00:00
|
|
|
long Hash32(std::string str);
|
|
|
|
long long Hash64(std::string str);
|
2015-09-18 05:53:53 +00:00
|
|
|
long ToInt32(std::string str);
|
|
|
|
long long ToInt64(std::string str);
|
|
|
|
void ToInt128(std::string str, char *out);
|
|
|
|
std::string ToString(unsigned long ID);
|
|
|
|
std::string ToString(unsigned long long ID);
|
2015-07-26 21:39:49 +00:00
|
|
|
bool IsHexString(std::string str, bool requirePrefix = false, long width = -1);
|
|
|
|
std::string AppendSlash(std::string str);
|
|
|
|
CStringList Tokenize(const std::string& str, const char *pTokens);
|
|
|
|
|
|
|
|
std::wstring UTF8to16(std::string str);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // STRINGUTIL_H
|