CBlueUI  
C++ 跨平台跨框架的数据可视化工具
载入中...
搜索中...
未找到
UtilsString 命名空间参考

枚举

enum  ChinaPinyinOption { PY_MASK_FULLNAME = 1 , PY_MASK_FIRST_CAPS = 1 << 1 , PY_MASK_ALL_CAPS = 1 << 2 , PY_MASK_INSERT_SPACE = 1 << 3 }

函数

UI_EXP bool IsASCIITextA (const char *str, int len=-1)
 判断字符串是否为ASCII
UI_EXP bool IsASCIITextW (LPCWSTR str, int len=-1)
 判断字符串是否为ASCII
UI_EXP bool IsASCIIText (LPCTSTR str, int len=-1)
 判断字符串是否为ASCII
UI_EXP bool IsUTF8 (const char *str)
 判断字符是否是UTF8编码方式
UI_EXP bool IsGBK (const char *str)
 判断字符是否是GBK编码方式
UI_EXP bool ToMulitLinesA (std::vector< std::string > &lines, const char *str, unsigned int len)
 根据换行符,将字符串转换为多行
UI_EXP bool ToNumsA (std::vector< double > &nums, const char *str)
 根据空格符号,将字符串转换为数值数组
UI_EXP int ConverterMultiByteToWideChar (UINT code_page, const char *multi_byte_str, int multi_byte_str_len, WCHAR *lp_wide_char_str, int wide_str_len)
UI_EXP int ConverterWideCharToMultiByte (UINT code_page, const WCHAR *wide_str, int wide_str_len, char *multi_byte_str, int multi_byte_str_len)
UI_EXP int CodepointToUtf8 (char *buf, int buf_size, unsigned int code_point)
 convert unicode to utf8
UI_EXP int Utf8ToCodepoint (uint32_t *out_char, const char *in_text, const char *in_text_end)
 将utf8字符转换为unicode码点(codepoint)
UI_EXP bool Utf16ToCodepoint (uint32_t *out_char, const WCHAR *str, int len)
 将utf16字符转换为unicode码点(codepoint)
UI_EXP int ToMultiByte (BasicStringBufferA &out_str, const char *src, int len, UINT cp_from, UINT cp_to)
 格式转换
UI_EXP int UnicodeToMultiByte (BasicStringBufferA &out_str, const WCHAR *wc, int len, UINT cp_to=CP_UTF8)
 unicode字符转换为多字符集(GBK,ISO)
UI_EXP int MultiByteToUnicode (BasicStringBufferW &out_str, const char *src, int len, UINT cp_from)
 多字符集(GBK,ISO) 转换为unicode字符
UI_EXP uint32_t ToHashId (uint8_t *data, int len, uint32_t seed=0x9747b28c)
 获得字节序列的哈希值。基于MurmurHash3
UI_EXP void UnicodeToChinaPinyin (LPCSTR utf8_str, UINT options, std::string &result)
 转换为拼音
UI_EXP BOOL IsLittleEnding ()
 是否是小端模式
UI_EXP BOOL IsStackPtr (const void *p)
UI_EXP BOOL IsDecimalFormateA (const char *str, int len=-1)
 是否满足小数输入格式
UI_EXP BOOL IsIntegerA (const char *str, int len=-1)
UI_EXP BOOL IsIdentfierA (const char *str, int len=-1)
UI_EXP BOOL IsDecimalFormateW (const WCHAR *str, int len=-1)
 是否满足小数输入格式
UI_EXP BOOL IsIntegerW (const WCHAR *str, int len=-1)
UI_EXP BOOL IsIdentfierW (const WCHAR *str, int len=-1)
UI_EXP BOOL IsDecimalFormate (const TCHAR *str, int len=-1)
 是否满足小数输入格式
UI_EXP BOOL IsInteger (const TCHAR *str, int len=-1)
UI_EXP BOOL IsIdentfier (const TCHAR *str, int len=-1)
UI_EXP int GetIntegerCharCount (int v)
 获得整数需要的十进制位数位数
UI_EXP int GetSymbolCharsCount (LPCTSTR text, int count)
 返回字符个数
UI_EXP LPCSTR FindNextBracketA (LPCSTR text, char start_bracket, char end_bracket, int levels=0)
 返回括号分组的结束位置
UI_EXP LPCWSTR FindNextBracketW (LPCWSTR text, WCHAR start_bracket, WCHAR end_bracket, int levels=0)
 返回括号分组的结束位置
UI_EXP std::vector< std::string > SplitWithCharA (const char *str, const char *pattern, int count=0, BOOL skip_bracket=FALSE)
 字符串分词拆分。单个字符匹配
UI_EXP std::vector< std::w16string > SplitWithCharW (const WCHAR *str, const WCHAR *pattern, int count=0, BOOL skip_bracket=FALSE)
UI_EXP std::vector< std::string > SplitWithTextA (std::string str, const std::string &pattern, int count=0)
 字符串分词拆分。字符串匹配
UI_EXP std::vector< std::w16string > SplitWithTextW (std::w16string str, const std::w16string &pattern, int count=0)
UI_EXP void SplitAttribute (const TCHAR *text, std::vector< std::pair< std::tstring, std::tstring > > &result, TCHAR ch_split=(TCHAR)';')
UI_EXP bool CalculatorValue (double &value, const char *str, int len=-1)
 计算器解析器
UI_EXP void ConvertBaseTextToBytes (BasicStringBufferA &out_buf, int &len, LPCTSTR str, int base)
 将基于base进制的字符串转换为字节流
UI_EXP void GetPrevDirPath (LPCTSTR full_name, BasicStringBuffer &prev_path)
 获取上级目录
UI_EXP void GetPrevDirPathA (LPCSTR full_name, BasicStringBufferA &prev_path)
UI_EXP void GetPrevDirPathW (LPCWSTR full_name, BasicStringBufferW &prev_path)
UI_EXP void GetFileSuffix (LPCTSTR full_name, BasicStringBuffer &suffix, BOOL is_complete=TRUE)
 获取文件后缀
UI_EXP void GetFileSuffixA (LPCSTR full_name, BasicStringBufferA &suffix, BOOL is_complete=TRUE)
UI_EXP void GetFileSuffixW (LPCWSTR full_name, BasicStringBufferW &suffix, BOOL is_complete=TRUE)
UI_EXP void GetFileBaseName (LPCTSTR full_name, BasicStringBuffer &base_name, BOOL is_complete=TRUE)
 获取文件名
UI_EXP void GetFileBaseNameA (LPCSTR full_name, BasicStringBufferA &base_name, BOOL is_complete=TRUE)
UI_EXP void GetFileBaseNameW (LPCWSTR full_name, BasicStringBufferW &base_name, BOOL is_complete=TRUE)
UI_EXP void GetFileName (LPCTSTR full_name, BasicStringBuffer &filename)
 获取文件名称
UI_EXP void GetFilePath (LPCTSTR full_name, BasicStringBuffer &filepath)
 获取路径,不包含文件
UI_EXP void ParseToAlign (UINT &align, LPCTSTR value)
 解析对齐方式
UI_EXP void IntToString (int num, int base, BasicStringBuffer &target)
 整数转换为文本。(2,8,10,16 进制)
UI_EXP bool ParserNumericalValueA (const char *str, const char *end, char **next_ptr, double &value, int &is_percent_value)
 解析数值。(可识别模式 156.e-2,0b1101,0o154,0x1245,#5421)
UI_EXP bool ParserNumericalValueW (const WCHAR *str, const WCHAR *end, WCHAR **next_ptr, double &value, int &is_percent_value)
UI_EXP bool ParserNumericalValue (const TCHAR *str, const TCHAR *end, TCHAR **next_ptr, double &value, int &is_percent_value)
UI_EXP int ParserToIntA (const char *str, int base=10)
 解析进制整数。(2,8,10,16 进制)
UI_EXP int ParserToIntW (const WCHAR *str, int base=10)
UI_EXP int ParserToInt (const TCHAR *str, int base=10)
UI_EXP double ParserToDoubleA (const char *str, bool is_expr_recognition)
UI_EXP double ParserToDoubleW (const WCHAR *str, bool is_expr_recognition)
UI_EXP double ParserToDouble (const TCHAR *str, bool is_expr_recognition)
UI_EXP PenType ParserPenType (const TCHAR *str)
 解析画笔类型 solid, dot, dash, dash-dot, dash-dot-dot
UI_EXP void SkipSpaceOrChar (const char **str, char c)
 跳过指定字符
UI_EXP int ParseCsvDoubles (const char *str, double *value, int num_values, char **next)
 解析以逗号分隔的数值
UI_EXP int ParseCsvDoublesWChar (const WCHAR *str, double *value, int num_values, WCHAR **next)

枚举类型说明

◆ ChinaPinyinOption

枚举值
PY_MASK_FULLNAME 
PY_MASK_FIRST_CAPS 
PY_MASK_ALL_CAPS 
PY_MASK_INSERT_SPACE 

函数说明

◆ CalculatorValue()

UI_EXP bool UtilsString::CalculatorValue ( double & value,
const char * str,
int len = -1 )

计算器解析器

◆ CodepointToUtf8()

UI_EXP int UtilsString::CodepointToUtf8 ( char * buf,
int buf_size,
unsigned int code_point )

convert unicode to utf8

参数
buf输出utf8格式字符缓冲
buf_size
code_point宽字符编码
返回
int 返回utf8字节数

◆ ConvertBaseTextToBytes()

UI_EXP void UtilsString::ConvertBaseTextToBytes ( BasicStringBufferA & out_buf,
int & len,
LPCTSTR str,
int base )

将基于base进制的字符串转换为字节流

◆ ConverterMultiByteToWideChar()

UI_EXP int UtilsString::ConverterMultiByteToWideChar ( UINT code_page,
const char * multi_byte_str,
int multi_byte_str_len,
WCHAR * lp_wide_char_str,
int wide_str_len )

◆ ConverterWideCharToMultiByte()

UI_EXP int UtilsString::ConverterWideCharToMultiByte ( UINT code_page,
const WCHAR * wide_str,
int wide_str_len,
char * multi_byte_str,
int multi_byte_str_len )

◆ FindNextBracketA()

UI_EXP LPCSTR UtilsString::FindNextBracketA ( LPCSTR text,
char start_bracket,
char end_bracket,
int levels = 0 )

返回括号分组的结束位置

◆ FindNextBracketW()

UI_EXP LPCWSTR UtilsString::FindNextBracketW ( LPCWSTR text,
WCHAR start_bracket,
WCHAR end_bracket,
int levels = 0 )

返回括号分组的结束位置

◆ GetFileBaseName()

UI_EXP void UtilsString::GetFileBaseName ( LPCTSTR full_name,
BasicStringBuffer & base_name,
BOOL is_complete = TRUE )

获取文件名

参数
is_complete完整后缀

◆ GetFileBaseNameA()

UI_EXP void UtilsString::GetFileBaseNameA ( LPCSTR full_name,
BasicStringBufferA & base_name,
BOOL is_complete = TRUE )

◆ GetFileBaseNameW()

UI_EXP void UtilsString::GetFileBaseNameW ( LPCWSTR full_name,
BasicStringBufferW & base_name,
BOOL is_complete = TRUE )

◆ GetFileName()

UI_EXP void UtilsString::GetFileName ( LPCTSTR full_name,
BasicStringBuffer & filename )

获取文件名称

◆ GetFilePath()

UI_EXP void UtilsString::GetFilePath ( LPCTSTR full_name,
BasicStringBuffer & filepath )

获取路径,不包含文件

◆ GetFileSuffix()

UI_EXP void UtilsString::GetFileSuffix ( LPCTSTR full_name,
BasicStringBuffer & suffix,
BOOL is_complete = TRUE )

获取文件后缀

参数
is_complete完整后缀比如xxxx.tar.gz(.tar.gz称之为完整后缀)

◆ GetFileSuffixA()

UI_EXP void UtilsString::GetFileSuffixA ( LPCSTR full_name,
BasicStringBufferA & suffix,
BOOL is_complete = TRUE )

◆ GetFileSuffixW()

UI_EXP void UtilsString::GetFileSuffixW ( LPCWSTR full_name,
BasicStringBufferW & suffix,
BOOL is_complete = TRUE )

◆ GetIntegerCharCount()

UI_EXP int UtilsString::GetIntegerCharCount ( int v)

获得整数需要的十进制位数位数

◆ GetPrevDirPath()

UI_EXP void UtilsString::GetPrevDirPath ( LPCTSTR full_name,
BasicStringBuffer & prev_path )

获取上级目录

◆ GetPrevDirPathA()

UI_EXP void UtilsString::GetPrevDirPathA ( LPCSTR full_name,
BasicStringBufferA & prev_path )

◆ GetPrevDirPathW()

UI_EXP void UtilsString::GetPrevDirPathW ( LPCWSTR full_name,
BasicStringBufferW & prev_path )

◆ GetSymbolCharsCount()

UI_EXP int UtilsString::GetSymbolCharsCount ( LPCTSTR text,
int count )

返回字符个数

◆ IntToString()

UI_EXP void UtilsString::IntToString ( int num,
int base,
BasicStringBuffer & target )

整数转换为文本。(2,8,10,16 进制)

参数
num待转换的数值
base目标字符串的进制
[out]outstr :输出到目标字符串

◆ IsASCIIText()

UI_EXP bool UtilsString::IsASCIIText ( LPCTSTR str,
int len = -1 )

判断字符串是否为ASCII

◆ IsASCIITextA()

UI_EXP bool UtilsString::IsASCIITextA ( const char * str,
int len = -1 )

判断字符串是否为ASCII

◆ IsASCIITextW()

UI_EXP bool UtilsString::IsASCIITextW ( LPCWSTR str,
int len = -1 )

判断字符串是否为ASCII

◆ IsDecimalFormate()

UI_EXP BOOL UtilsString::IsDecimalFormate ( const TCHAR * str,
int len = -1 )

是否满足小数输入格式

◆ IsDecimalFormateA()

UI_EXP BOOL UtilsString::IsDecimalFormateA ( const char * str,
int len = -1 )

是否满足小数输入格式

◆ IsDecimalFormateW()

UI_EXP BOOL UtilsString::IsDecimalFormateW ( const WCHAR * str,
int len = -1 )

是否满足小数输入格式

◆ IsGBK()

UI_EXP bool UtilsString::IsGBK ( const char * str)

判断字符是否是GBK编码方式

◆ IsIdentfier()

UI_EXP BOOL UtilsString::IsIdentfier ( const TCHAR * str,
int len = -1 )

◆ IsIdentfierA()

UI_EXP BOOL UtilsString::IsIdentfierA ( const char * str,
int len = -1 )

◆ IsIdentfierW()

UI_EXP BOOL UtilsString::IsIdentfierW ( const WCHAR * str,
int len = -1 )

◆ IsInteger()

UI_EXP BOOL UtilsString::IsInteger ( const TCHAR * str,
int len = -1 )

◆ IsIntegerA()

UI_EXP BOOL UtilsString::IsIntegerA ( const char * str,
int len = -1 )

◆ IsIntegerW()

UI_EXP BOOL UtilsString::IsIntegerW ( const WCHAR * str,
int len = -1 )

◆ IsLittleEnding()

UI_EXP BOOL UtilsString::IsLittleEnding ( )

是否是小端模式

◆ IsStackPtr()

UI_EXP BOOL UtilsString::IsStackPtr ( const void * p)

◆ IsUTF8()

UI_EXP bool UtilsString::IsUTF8 ( const char * str)

判断字符是否是UTF8编码方式

◆ MultiByteToUnicode()

UI_EXP int UtilsString::MultiByteToUnicode ( BasicStringBufferW & out_str,
const char * src,
int len,
UINT cp_from )

多字符集(GBK,ISO) 转换为unicode字符

参数
out_str转换后的unicode字符集
src多字符集串
len转换长度
cp_from多字符集编码 GBK, ISO

◆ ParseCsvDoubles()

UI_EXP int UtilsString::ParseCsvDoubles ( const char * str,
double * value,
int num_values,
char ** next )

解析以逗号分隔的数值

参数
str输入
value输出缓冲数组
num_values缓冲大小
next下次扫描位置

◆ ParseCsvDoublesWChar()

UI_EXP int UtilsString::ParseCsvDoublesWChar ( const WCHAR * str,
double * value,
int num_values,
WCHAR ** next )

◆ ParserNumericalValue()

UI_EXP bool UtilsString::ParserNumericalValue ( const TCHAR * str,
const TCHAR * end,
TCHAR ** next_ptr,
double & value,
int & is_percent_value )

◆ ParserNumericalValueA()

UI_EXP bool UtilsString::ParserNumericalValueA ( const char * str,
const char * end,
char ** next_ptr,
double & value,
int & is_percent_value )

解析数值。(可识别模式 156.e-2,0b1101,0o154,0x1245,#5421)

参数
str扫描字符串开始位置
end扫描字符串结束位置
[out]value :输出数值
[out]is_percent_value :输出数值是否为百分比模式
[out]next_ptr :输出下一次解析的指针位置
返回
返回下一次解析的指针位置。若一次解析全部,则返回空

◆ ParserNumericalValueW()

UI_EXP bool UtilsString::ParserNumericalValueW ( const WCHAR * str,
const WCHAR * end,
WCHAR ** next_ptr,
double & value,
int & is_percent_value )

◆ ParserPenType()

UI_EXP PenType UtilsString::ParserPenType ( const TCHAR * str)

解析画笔类型 solid, dot, dash, dash-dot, dash-dot-dot

◆ ParserToDouble()

UI_EXP double UtilsString::ParserToDouble ( const TCHAR * str,
bool is_expr_recognition )

◆ ParserToDoubleA()

UI_EXP double UtilsString::ParserToDoubleA ( const char * str,
bool is_expr_recognition )

◆ ParserToDoubleW()

UI_EXP double UtilsString::ParserToDoubleW ( const WCHAR * str,
bool is_expr_recognition )

◆ ParserToInt()

UI_EXP int UtilsString::ParserToInt ( const TCHAR * str,
int base = 10 )

◆ ParserToIntA()

UI_EXP int UtilsString::ParserToIntA ( const char * str,
int base = 10 )

解析进制整数。(2,8,10,16 进制)

◆ ParserToIntW()

UI_EXP int UtilsString::ParserToIntW ( const WCHAR * str,
int base = 10 )

◆ ParseToAlign()

UI_EXP void UtilsString::ParseToAlign ( UINT & align,
LPCTSTR value )

解析对齐方式

◆ SkipSpaceOrChar()

UI_EXP void UtilsString::SkipSpaceOrChar ( const char ** str,
char c )

跳过指定字符

◆ SplitAttribute()

UI_EXP void UtilsString::SplitAttribute ( const TCHAR * text,
std::vector< std::pair< std::tstring, std::tstring > > & result,
TCHAR ch_split = (TCHAR)';' )

◆ SplitWithCharA()

UI_EXP std::vector< std::string > UtilsString::SplitWithCharA ( const char * str,
const char * pattern,
int count = 0,
BOOL skip_bracket = FALSE )

字符串分词拆分。单个字符匹配

参数
str输入字符串
pattern分割字符集合
count匹配次数
skip_bracketTRUE:忽略被{'(', ')'}, {'[', ']'}, {'{', '}'}, {'<', '>'}包裹的匹配字符
返回
std::vector<std::string> 分词结果

◆ SplitWithCharW()

UI_EXP std::vector< std::w16string > UtilsString::SplitWithCharW ( const WCHAR * str,
const WCHAR * pattern,
int count = 0,
BOOL skip_bracket = FALSE )

◆ SplitWithTextA()

UI_EXP std::vector< std::string > UtilsString::SplitWithTextA ( std::string str,
const std::string & pattern,
int count = 0 )

字符串分词拆分。字符串匹配

参数
str输入字符串
pattern分割字符串
count匹配次数
skip_bracketTRUE:忽略被{'(', ')'}, {'[', ']'}, {'{', '}'}, {'<', '>'}包裹的匹配字符串
返回
std::vector<std::string> 分词结果

◆ SplitWithTextW()

UI_EXP std::vector< std::w16string > UtilsString::SplitWithTextW ( std::w16string str,
const std::w16string & pattern,
int count = 0 )

◆ ToHashId()

UI_EXP uint32_t UtilsString::ToHashId ( uint8_t * data,
int len,
uint32_t seed = 0x9747b28c )

获得字节序列的哈希值。基于MurmurHash3

参数
data数据
len数据长度
seed种子

◆ ToMulitLinesA()

UI_EXP bool UtilsString::ToMulitLinesA ( std::vector< std::string > & lines,
const char * str,
unsigned int len )

根据换行符,将字符串转换为多行

◆ ToMultiByte()

UI_EXP int UtilsString::ToMultiByte ( BasicStringBufferA & out_str,
const char * src,
int len,
UINT cp_from,
UINT cp_to )

格式转换

◆ ToNumsA()

UI_EXP bool UtilsString::ToNumsA ( std::vector< double > & nums,
const char * str )

根据空格符号,将字符串转换为数值数组

◆ UnicodeToChinaPinyin()

UI_EXP void UtilsString::UnicodeToChinaPinyin ( LPCSTR utf8_str,
UINT options,
std::string & result )

转换为拼音

参数
utf8_strutf8格式字符
options:ChinaPinyinOption
[out]result:

◆ UnicodeToMultiByte()

UI_EXP int UtilsString::UnicodeToMultiByte ( BasicStringBufferA & out_str,
const WCHAR * wc,
int len,
UINT cp_to = CP_UTF8 )

unicode字符转换为多字符集(GBK,ISO)

参数
out_str转换后的多字符集
wcunicode宽字符
len转换长度
cp_to多字符集编码 GBK, ISO

◆ Utf16ToCodepoint()

UI_EXP bool UtilsString::Utf16ToCodepoint ( uint32_t * out_char,
const WCHAR * str,
int len )

将utf16字符转换为unicode码点(codepoint)

参数
out_char输出参数:码点
str输入字符
len字符长度
返回
bool 是否成功

◆ Utf8ToCodepoint()

UI_EXP int UtilsString::Utf8ToCodepoint ( uint32_t * out_char,
const char * in_text,
const char * in_text_end )

将utf8字符转换为unicode码点(codepoint)

参数
out_char输出参数:码点
in_text起始字符
in_text_end结束字符
返回
int 返回转换utf8占用字节数
鄂公网安备42018502007752 鄂ICP备2024082886
Copyright © 2026 · CBlueStudio 版权所有