Mercurial > minori
comparison include/core/strings.h @ 116:254b1d2b7096
settings: add torrents page, make rss feed configurable
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 07 Nov 2023 13:52:13 -0500 |
parents | ab191e28e69d |
children | 39521c47c7a3 |
comparison
equal
deleted
inserted
replaced
115:c72b907b9bef | 116:254b1d2b7096 |
---|---|
5 #include <vector> | 5 #include <vector> |
6 #include <array> | 6 #include <array> |
7 #include <cstdint> | 7 #include <cstdint> |
8 | 8 |
9 class QString; | 9 class QString; |
10 class QByteArray; | |
10 | 11 |
11 namespace Strings { | 12 namespace Strings { |
12 | 13 |
13 /* Implode function: takes a vector of strings and turns it | 14 /* Implode function: takes a vector of strings and turns it |
14 into a string, separated by delimiters. */ | 15 into a string, separated by delimiters. */ |
30 different string formats universal */ | 31 different string formats universal */ |
31 std::wstring ToWstring(const std::string& string); | 32 std::wstring ToWstring(const std::string& string); |
32 std::wstring ToWstring(const QString& string); | 33 std::wstring ToWstring(const QString& string); |
33 std::string ToUtf8String(const std::wstring& wstring); | 34 std::string ToUtf8String(const std::wstring& wstring); |
34 std::string ToUtf8String(const QString& string); | 35 std::string ToUtf8String(const QString& string); |
36 std::string ToUtf8String(const QByteArray& ba); | |
35 QString ToQString(const std::string& string); | 37 QString ToQString(const std::string& string); |
36 QString ToQString(const std::wstring& wstring); | 38 QString ToQString(const std::wstring& wstring); |
37 | 39 |
38 /* arithmetic :) */ | 40 /* arithmetic :) */ |
39 int ToInt(const std::string& str, int def = 0); | 41 int ToInt(const std::string& str, int def = 0); |
42 | |
43 bool ToBool(const std::string& s, const bool def = false); | |
44 std::string ToUtf8String(const bool b); | |
40 | 45 |
41 uint64_t HumanReadableSizeToBytes(const std::string& str); | 46 uint64_t HumanReadableSizeToBytes(const std::string& str); |
42 | 47 |
43 std::string RemoveLeadingChars(std::string s, const char c); | 48 std::string RemoveLeadingChars(std::string s, const char c); |
44 std::string RemoveTrailingChars(std::string s, const char c); | 49 std::string RemoveTrailingChars(std::string s, const char c); |