wangzhengquan
2020-06-11 5c9cbf5ea152f501ae976e0e0b4ef5ee98afdfba
common/include/usg_common.h
@@ -79,6 +79,10 @@
void err_exit(int error, const char *fmt, ...);
void err_msg(int error, const char *fmt, ...);
char *ltrim(char *str, const char *seps);
char *rtrim(char *str, const char *seps);
char *trim(char *str, const char *seps);
static inline int 
itoa(int num, char *str) 
{
@@ -93,7 +97,34 @@
}
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
// static inline std::string& ltrim(std::string& str, const std::string& chars = "\t\n\v\f\r ")
// {
//     str.erase(0, str.find_first_not_of(chars));
//     return str;
// }
// static inline std::string& rtrim(std::string& str, const std::string& chars = "\t\n\v\f\r ")
// {
//     str.erase(str.find_last_not_of(chars) + 1);
//     return str;
// }
// static inline std::string& trim(std::string& str, const std::string& chars = "\t\n\v\f\r ")
// {
//     return ltrim(rtrim(str, chars), chars);
// }
#endif
#endif