|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
#ifndef COMMON_H |
|
|
|
|
#define COMMON_H |
|
|
|
|
//#include <algorithm>
|
|
|
|
|
#include <cctype> |
|
|
|
|
#include <iostream> |
|
|
|
|
#include <list> |
|
|
|
|
#include <memory> |
|
|
|
|
#include <set> |
|
|
|
|
#include <string> |
|
|
|
@ -397,4 +397,20 @@ inline bool str2uint(const std::string& str, int64_t* res) {return str2uint(str.
|
|
|
|
|
inline void tolower(std::string& str) {for(auto& p: str) p=tolower(p);} |
|
|
|
|
inline void tolower(std::string* str) {for(auto& p:*str) p=tolower(p);} |
|
|
|
|
inline void tolower(char* str) {for(*str=tolower(*str);'\0'!=*str++;*str=tolower(*str));} |
|
|
|
|
|
|
|
|
|
typedef std::list<std::string> WordList; |
|
|
|
|
|
|
|
|
|
EXPORT WordList Split(const std::string& str, const std::string& delims, bool allowempty); |
|
|
|
|
|
|
|
|
|
inline WordList Split(const std::string& str) {return Split(str,std::string(" \t",3),false);} |
|
|
|
|
inline WordList Split(const char* str) {return Split(std::string(str),std::string(" \t",3),false);} |
|
|
|
|
|
|
|
|
|
inline WordList Split(const std::string& str, bool allowempty) {return Split(str,std::string(" \t",3),allowempty);} |
|
|
|
|
inline WordList Split(const char* str, bool allowempty) {return Split(std::string(str),std::string(" \t",3),allowempty);} |
|
|
|
|
|
|
|
|
|
inline WordList Split(const std::string& str, const std::string& delims) {return Split(str,delims,false);} |
|
|
|
|
inline WordList Split(const char* str, const std::string& delims) {return Split(std::string(str),delims,false);} |
|
|
|
|
inline WordList Split(const std::string& str, const char* delims) {return Split(str,std::string(delims),false);} |
|
|
|
|
inline WordList Split(const char* str, const char* delims) {return Split(std::string(str),std::string(delims),false);} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|