2022-11-04 01:11:55 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
namespace StringUtils {
|
2022-11-04 01:14:23 +05:30
|
|
|
|
|
|
|
#if defined Q_OS_WIN32
|
2022-11-04 01:29:03 +05:30
|
|
|
using string = std::wstring;
|
|
|
|
|
|
|
|
inline string toStdString(QString s)
|
2022-11-04 01:14:23 +05:30
|
|
|
{
|
|
|
|
return s.toStdWString();
|
|
|
|
}
|
2022-11-04 01:29:03 +05:30
|
|
|
inline QString fromStdString(string s)
|
|
|
|
{
|
|
|
|
return QString::fromStdWString(s);
|
|
|
|
}
|
2022-11-04 01:14:23 +05:30
|
|
|
#else
|
2022-11-04 01:29:03 +05:30
|
|
|
using string = std::string;
|
|
|
|
|
|
|
|
inline string toStdString(QString s)
|
2022-11-04 01:14:23 +05:30
|
|
|
{
|
|
|
|
return s.toStdString();
|
|
|
|
}
|
2022-11-04 01:29:03 +05:30
|
|
|
inline QString fromStdString(string s)
|
|
|
|
{
|
|
|
|
return QString::fromStdString(s);
|
|
|
|
}
|
2022-11-04 01:14:23 +05:30
|
|
|
#endif
|
|
|
|
|
2022-11-04 01:11:55 +05:30
|
|
|
int naturalCompare(const QString& s1, const QString& s2, Qt::CaseSensitivity cs);
|
2023-02-08 14:05:03 +05:30
|
|
|
|
2023-02-24 07:38:35 +05:30
|
|
|
QString getRandomAlphaNumeric();
|
2022-11-04 01:11:55 +05:30
|
|
|
} // namespace StringUtils
|