![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Util
hp_truth
一个热爱技术的人
展开
-
generate UUID using uuid library or system uuid
#include string Util::generateUUID(){#if 0 uuid_t uu; uuid_generate(uu); char buffer[32] = {0}; uuid_unparse(uu, buffer); //cout << buffer << endl; return string(buffer);#原创 2014-10-10 10:40:26 · 1471 阅读 · 0 评论 -
split STL string by chars
vector split(const string& src, const string& separator){ vector result; string str = src; string substring; string::size_type start = 0, index; do { index = str.find原创 2014-10-10 10:19:50 · 457 阅读 · 0 评论 -
add delimiter into string
#include #include using namespace std;string formatString(const string& str, int segWidth, char delimiter){ size_t size = str.size(); size_t pos = 0; string result; if (size > 0原创 2014-10-10 12:03:02 · 461 阅读 · 0 评论 -
stricmp in STL
inline bool nocase_compare (char c1, char c2){ return toupper(c1) == toupper(c2);}inline bool str_nocase_cmp(const std::string &str1, const std::string &str2){if(&str1 == &str2)return true;if(str1.siz原创 2014-10-09 18:09:48 · 431 阅读 · 0 评论 -
获取linux机器的IP和mac地址
#include // for ::strncpy#include // for ::ioctl#include // for inet_ntoa#include // for struct ifreq#include // for ::close#include #include #include using namespace std;int GetNetDev原创 2014-10-10 16:47:12 · 1514 阅读 · 0 评论 -
sed之大小写转换
转自: http://blog.chinaunix.net/uid-10540984-id-2014878.html转载 2014-10-11 10:24:43 · 3694 阅读 · 0 评论 -
c++ 判断文件是否存在
bool fileExist(const string& name){ ifstream ifs(name); if(ifs.is_open()) { ifs.close(); return true; } else { return false; }}原创 2014-10-15 18:05:13 · 1005 阅读 · 0 评论