SimpleWindow
载入中...
搜索中...
未找到
sw::Utils类 参考

工具类 更多...

#include <Utils.h>

静态 Public 成员函数

static std::wstring ToWideStr (const std::string &str, bool utf8=false)
 将窄字符串转为宽字符串
 
static std::string ToMultiByteStr (const std::wstring &wstr, bool utf8=false)
 将宽字符串转为窄字符串
 
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)
 对字符串按照指定分隔符进行拆分
 
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
 

详细描述

工具类

成员函数说明

◆ Split()

static std::vector< std::wstring > sw::Utils::Split ( const std::wstring & str,
const std::wstring & delimiter )
static

对字符串按照指定分隔符进行拆分

参数
str输入的字符串
delimiter分隔符
返回
包含字串的vector

◆ ToMultiByteStr()

static std::string sw::Utils::ToMultiByteStr ( const std::wstring & wstr,
bool utf8 = false )
static

将宽字符串转为窄字符串

参数
wstr要转换的字符串
utf8是否使用utf8编码
返回
转换后的字符串

◆ ToWideStr()

static std::wstring sw::Utils::ToWideStr ( const std::string & str,
bool utf8 = false )
static

将窄字符串转为宽字符串

参数
str要转换的字符串
utf8是否使用utf8编码
返回
转换后的字符串

◆ Trim()

static std::wstring sw::Utils::Trim ( const std::wstring & str)
static

删除首尾空白字符

参数
str输入的字符串
返回
删除首位空白字符后的字符串

◆ TrimEnd()

static std::wstring sw::Utils::TrimEnd ( const std::wstring & str)
static

删除串尾空白字符

参数
str输入的字符串
返回
删除串尾空白字符后的字符串

◆ TrimStart()

static std::wstring sw::Utils::TrimStart ( const std::wstring & str)
static

删除串首空白字符

参数
str输入的字符串
返回
删除串首空白字符后的字符串

该类的文档由以下文件生成: