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 CodePage, const char *lpMultiByteStr, int cbMultiByte, WCHAR *lpWideCharStr, int cchWideChar)
 
UI_EXP int ConverterWideCharToMultiByte (UINT CodePage, const WCHAR *lpWideCharStr, int cchWideChar, char *lpMultiByteStr, int cbMultiByte)
 
UI_EXP int WideCharToUtf8 (char *buf, int buf_size, unsigned int code_point)
 convert unicode to utf8
 
UI_EXP int Utf8CharToWide (unsigned int *out_char, const char *in_text, const char *in_text_end)
 convert utf8 to unicode
 
UI_EXP int ToMultiByte (const char *src, int len, BasicStringBufferA &outstr, UINT cp_from, UINT cp_to)
 格式转换
 
UI_EXP int UnicodeToMultiByte (const WCHAR *wc, int len, BasicStringBufferA &outstr, UINT cp_to=CP_UTF8)
 unicode字符转换为多字符集(GBK,ISO)
 
UI_EXP int MultiByteToUnicode (const char *src, int len, BasicStringBufferW &outstr, UINT cp_from)
 多字符集(GBK,ISO) 转换为unicode字符
 
UI_EXP void UnicodeToChinaPinyin (LPCSTR utf8Str, UINT options, std::string &result)
 转换为拼音
 
UI_EXP BOOL IsLittleEnding ()
 是否是小端模式
 
UI_EXP BOOL IsStackPtr (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 GetCharsCount (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, std::string pattern, int count=0)
 字符串分词拆分。字符串匹配
 
UI_EXP std::vector< std::w16string > SplitWithTextW (std::w16string str, std::w16string pattern, int count=0)
 
UI_EXP void SplitAttribute (const TCHAR *text, std::vector< std::pair< std::tstring, std::tstring > > &result, TCHAR SplitCharacter=(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 fullname, BasicStringBuffer &prev_path)
 获取上级目录
 
UI_EXP void GetPrevDirPathA (LPCSTR fullname, BasicStringBufferA &prev_path)
 
UI_EXP void GetPrevDirPathW (LPCWSTR fullname, BasicStringBufferW &prev_path)
 
UI_EXP void GetFileSuffix (LPCTSTR fullname, BasicStringBuffer &suffix, BOOL isComplete=TRUE)
 获取文件后缀
 
UI_EXP void GetFileSuffixA (LPCSTR fullname, BasicStringBufferA &suffix, BOOL isComplete=TRUE)
 
UI_EXP void GetFileSuffixW (LPCWSTR fullname, BasicStringBufferW &suffix, BOOL isComplete=TRUE)
 
UI_EXP void GetFileBaseName (LPCTSTR fullname, BasicStringBuffer &basename, BOOL isComplete=TRUE)
 获取不包含后缀的文件名
 
UI_EXP void GetFileBaseNameA (LPCSTR fullname, BasicStringBufferA &basename, BOOL isComplete=TRUE)
 
UI_EXP void GetFileBaseNameW (LPCWSTR fullname, BasicStringBufferW &basename, BOOL isComplete=TRUE)
 
UI_EXP void GetFileName (LPCTSTR fullname, BasicStringBuffer &filename)
 获取文件名称
 
UI_EXP void GetFilePath (LPCTSTR fullname, 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 ExprRecognition)
 
UI_EXP double ParserToDoubleW (const WCHAR *str, bool ExprRecognition)
 
UI_EXP double ParserToDouble (const TCHAR *str, bool ExprRecognition)
 
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 bool ParseCsvDoubles (const char *str, double *value, int num_values, char **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 
)

计算器解析器

◆ ConvertBaseTextToBytes()

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

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

◆ ConverterMultiByteToWideChar()

UI_EXP int UtilsString::ConverterMultiByteToWideChar ( UINT  CodePage,
const char *  lpMultiByteStr,
int  cbMultiByte,
WCHAR lpWideCharStr,
int  cchWideChar 
)

◆ ConverterWideCharToMultiByte()

UI_EXP int UtilsString::ConverterWideCharToMultiByte ( UINT  CodePage,
const WCHAR lpWideCharStr,
int  cchWideChar,
char *  lpMultiByteStr,
int  cbMultiByte 
)

◆ 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 
)

返回括号分组的结束位置

◆ GetCharsCount()

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

返回字符个数

◆ GetFileBaseName()

UI_EXP void UtilsString::GetFileBaseName ( LPCTSTR  fullname,
BasicStringBuffer basename,
BOOL  isComplete = TRUE 
)

获取不包含后缀的文件名

参数
isComplete完整后缀

◆ GetFileBaseNameA()

UI_EXP void UtilsString::GetFileBaseNameA ( LPCSTR  fullname,
BasicStringBufferA basename,
BOOL  isComplete = TRUE 
)

◆ GetFileBaseNameW()

UI_EXP void UtilsString::GetFileBaseNameW ( LPCWSTR  fullname,
BasicStringBufferW basename,
BOOL  isComplete = TRUE 
)

◆ GetFileName()

UI_EXP void UtilsString::GetFileName ( LPCTSTR  fullname,
BasicStringBuffer filename 
)

获取文件名称

◆ GetFilePath()

UI_EXP void UtilsString::GetFilePath ( LPCTSTR  fullname,
BasicStringBuffer filepath 
)

获取路径,不包含文件

◆ GetFileSuffix()

UI_EXP void UtilsString::GetFileSuffix ( LPCTSTR  fullname,
BasicStringBuffer suffix,
BOOL  isComplete = TRUE 
)

获取文件后缀

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

◆ GetFileSuffixA()

UI_EXP void UtilsString::GetFileSuffixA ( LPCSTR  fullname,
BasicStringBufferA suffix,
BOOL  isComplete = TRUE 
)

◆ GetFileSuffixW()

UI_EXP void UtilsString::GetFileSuffixW ( LPCWSTR  fullname,
BasicStringBufferW suffix,
BOOL  isComplete = TRUE 
)

◆ GetIntegerCharCount()

UI_EXP int UtilsString::GetIntegerCharCount ( int  v)

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

◆ GetPrevDirPath()

UI_EXP void UtilsString::GetPrevDirPath ( LPCTSTR  fullname,
BasicStringBuffer prev_path 
)

获取上级目录

◆ GetPrevDirPathA()

UI_EXP void UtilsString::GetPrevDirPathA ( LPCSTR  fullname,
BasicStringBufferA prev_path 
)

◆ GetPrevDirPathW()

UI_EXP void UtilsString::GetPrevDirPathW ( LPCWSTR  fullname,
BasicStringBufferW prev_path 
)

◆ 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 ( void *  p)

◆ IsUTF8()

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

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

◆ MultiByteToUnicode()

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

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

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

◆ ParseCsvDoubles()

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

解析以逗号分隔的数值

参数
str输入
value输出缓冲数组
num_values缓冲大小
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  ExprRecognition 
)

◆ ParserToDoubleA()

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

◆ ParserToDoubleW()

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

◆ 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  SplitCharacter = (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,
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,
std::w16string  pattern,
int  count = 0 
)

◆ ToMulitLinesA()

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

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

◆ ToMultiByte()

UI_EXP int UtilsString::ToMultiByte ( const char *  src,
int  len,
BasicStringBufferA outstr,
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  utf8Str,
UINT  options,
std::string &  result 
)

转换为拼音

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

◆ UnicodeToMultiByte()

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

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

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

◆ Utf8CharToWide()

UI_EXP int UtilsString::Utf8CharToWide ( unsigned int *  out_char,
const char *  in_text,
const char *  in_text_end 
)

convert utf8 to unicode

参数
out_char输出unicode字符
in_text起始字符
in_text_end结束字符
返回
int 返回转换utf8占用字节数

◆ WideCharToUtf8()

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

convert unicode to utf8

参数
buf输出utf8格式字符缓冲
buf_size
code_point宽字符编码
返回
int 返回utf8字节数
鄂公网安备42018502007752 鄂ICP备2024082886
Copyright © 2025 · CBlueStudio 版权所有