From 5c9cbf5ea152f501ae976e0e0b4ef5ee98afdfba Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期四, 11 六月 2020 19:20:40 +0800 Subject: [PATCH] pdate --- common/include/usg_common.h | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/common/include/usg_common.h b/common/include/usg_common.h index bf70221..358fbb3 100644 --- a/common/include/usg_common.h +++ b/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 -- Gitblit v1.8.0