4 #if __has_include(<format>) // C++20
29 #ifdef __cpp_lib_format // C++20 with <format>
30 return QString::fromStdString(std::format(
"{:0{}d}", n, width));
32 return QString(
"%1").arg(n, width, 10, QChar(
'0'));
33 #endif // __cpp_lib_format
36 inline QString
indentSpaces(
unsigned int level,
unsigned int size = 4)
38 return {
static_cast<int>(level * size), QChar(
' ')};
46 return (val) ? QStringLiteral(
"true") : QStringLiteral(
"false");
51 Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive);
58 Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive)
74 inline std::vector<std::string_view>
split_sv(
const std::string_view s,
const std::string_view delimiter)
77 if (delimiter.empty())
79 std::vector<std::string_view> tokens;
84 pos = s.find(delimiter, last_pos);
85 tokens.emplace_back(s.substr(last_pos, pos - last_pos));
86 last_pos = pos + delimiter.size();
88 while (pos != std::string_view::npos);
94 #endif // STRINGUTIL_H_