本文作者原创,首发在本博客;CSDN 上的同名文章已标注为转载并回链到本页:https://blog.csdn.net/qq_30220519/article/details/139664297
strUtil.h
1 |
|
1 |
|
std::optional
if (/* some condition */) {
return 42;
}
return std::nullopt;
}
s.substr(0, str.size()) == str
s.substr(str.size()) == str
std::stoi/stof/stod
// 随机字符串生成
inline std::string randomStringGenerator(const int len)
{
std::string res;
static const char alphanum[] = “0123456789”
“ABCDEFGHIJKLMNOPQRSTUVWXYZ”
“abcdefghijklmnopqrstuvwxyz”;
for (int i = 0; i < len; ++i)
res += alphanum[((size_t)std::rand() % (sizeof(alphanum) - 1))];
return res;
}
1 | inline bool replace(std::string & input_str, const std::string & from, const std::string & to) |
创作不易,小小的支持一下吧!

