|
SimpleWindow
|
工具类 更多...
#include <Utils.h>
静态 Public 成员函数 | |
| static void | UseUtf8Encoding (bool useUtf8) |
| 设置Utils类是否使用UTF-8编码进行字符串转换(默认启用) | |
| static std::wstring | ToWideStr (const std::string &str) |
| 将窄字符串转为宽字符串 | |
| static std::string | ToMultiByteStr (const std::wstring &wstr) |
| 将宽字符串转为窄字符串 | |
| static std::wstring | ToWideStr (const std::string &str, bool utf8) |
| 将窄字符串转为宽字符串 | |
| static std::string | ToMultiByteStr (const std::wstring &wstr, bool utf8) |
| 将宽字符串转为窄字符串 | |
| static std::wstring | Trim (const std::wstring &str) |
| 删除首尾空白字符 | |
| static std::wstring | TrimStart (const std::wstring &str) |
| 删除串首空白字符 | |
| static std::wstring | TrimEnd (const std::wstring &str) |
| 删除串尾空白字符 | |
| static std::vector< std::wstring > | Split (const std::wstring &str, const std::wstring &delimiter) |
| 对字符串按照指定分隔符进行拆分 | |
| static std::wstring | FormatStr (const wchar_t *fmt,...) |
格式化字符串,类似于 swprintf,但返回一个动态分配的 std::wstring | |
| template<typename T > | |
| static constexpr T | Max (const T &a, const T &b) |
| 取两值中的较大值 | |
| template<typename T > | |
| static constexpr T | Min (const T &a, const T &b) |
| 取两值中的较小值 | |
| template<typename... Args> | |
| static std::wstring | BuildStr (const Args &...args) |
| 拼接字符串,也可使用此函数将其他类型转为wstring | |
工具类
格式化字符串,类似于 swprintf,但返回一个动态分配的 std::wstring
| fmt | 格式化字符串 |
| ... | 可变参数,符合 fmt 格式的输入 |
|
static |
对字符串按照指定分隔符进行拆分
| str | 输入的字符串 |
| delimiter | 分隔符 |
将宽字符串转为窄字符串
| wstr | 要转换的字符串 |
将宽字符串转为窄字符串
| wstr | 要转换的字符串 |
| utf8 | 是否使用utf8编码 |
将窄字符串转为宽字符串
| str | 要转换的字符串 |
将窄字符串转为宽字符串
| str | 要转换的字符串 |
| utf8 | 是否使用utf8编码 |
删除首尾空白字符
| str | 输入的字符串 |
删除串尾空白字符
| str | 输入的字符串 |
删除串首空白字符
| str | 输入的字符串 |
设置Utils类是否使用UTF-8编码进行字符串转换(默认启用)
| useUtf8 | 若为true则使用UTF-8编码,否则使用系统默认编码 |