📄 commpublic.hpp
字号:
/** * 公共函数 Version 1.0 * * Create: 2004-06-30 Modify: 2004-06-30 Complete: 2004-07-10 */#ifndef __COMMPUBLIC_H__#define __COMMPUBLIC_H__#include "common.hpp"/** @Prototype: BOOL IsEmptyStr(LPCSTR sSrcStr) * @Description: 判断串是空串? * @Parameter: LPCSTR sSrcStr 要检查的字符串 */BOOL IsEmptyStr(LPCSTR sSrcStr);/** @Prototype: BOOL IsSpaceStr(LPCSTR sSrcStr) * @Description: 判断串是空串或全空白串? * @Parameter: LPCSTR sSrcStr 要检查的字符串 */BOOL IsSpaceStr(LPCSTR sSrcStr, int nMaxLen = 0);/** @Prototype: BOOL IsDateString(LPCSTR sDateStr) * @Description: 检查日期格式? * @Parameter: LPCSTR sDateStr 要检查的字符串 */BOOL IsDateString(LPCSTR sDateStr, int nMaxLen = 0);/** @Prototype: BOOL IsChineseString(LPCSTR sSrcStr) * @Description: 检查是汉字串? * @Parameter: LPCSTR sSrcStr 要检查的字符串 */BOOL IsChineseString(LPCSTR sSrcStr, int nMaxLen = 0);/** @Prototype: BOOL IsNumberString(LPCSTR sSrcStr) * @Description: 检查是数字串? * @Parameter: LPCSTR sSrcStr 要检查的字符串 */BOOL IsNumberString(LPCSTR sSrcStr, int nMaxLen = 0);/** @Prototype: BOOL IsXSetString(LPCSTR sSrcStr) * @Description: 检查是X集字符? * @Parameter: LPCSTR sSrcStr 要检查的字符串 */BOOL IsXSetString(LPCSTR sSrcStr, BOOL bForCNAPS = TRUE, int nMaxLen = 0);/** @Prototype: BOOL IsXGSetString(LPCSTR sSrcStr) * @Description: 检查是XG集字符? * @Parameter: LPCSTR sSrcStr 要检查的字符串 */BOOL IsXGSetString(LPCSTR sSrcStr, BOOL bForCNAPS = TRUE, int nMaxLen = 0);/** @Prototype: LPTSTR StrHexCode(LPCSTR sSrcStr) * @Description: 打印串的各组成字符ASCII值 * @Parameter: LPCSTR sSrcStr 原始的字符串 */void StrPrintHexCode(LPCSTR sSrcStr);/** @Prototype: LPTSTR StrUpperCase(LPTSTR sSrcStr) * @Description: 转换为大写字串 * @Parameter: LPTSTR sSrcStr 原始的字符串 */LPTSTR StrUpperCase(LPTSTR sSrcStr);/** @Prototype: LPTSTR StrLowerCase(LPTSTR sSrcStr) * @Description: 转换为小写字串 * @Parameter: LPTSTR sSrcStr 原始的字符串 */LPTSTR StrLowerCase(LPTSTR sSrcStr); /** @Prototype: LPTSTR StrSetSpliter(LPTSTR sSrcStr,char ch = ' ') * @Description: 将串中间隔格式化为一个ch间隔 * @Parameter: LPTSTR sSrcStr 原始的字符串 */LPTSTR StrSetSpliter(LPTSTR sSrcStr,char ch = ' ');/** @Prototype: LPTSTR StrTrimLeft(LPTSTR sSrcStr, BOOL bNotTrimCRLFChar=FALSE) * @Description: 清除字符串左边空白 * @Parameter: LPTSTR sSrcStr 原始的字符串 * @Parameter: BOOL bNotTrimCRLFChar 清除回车换行符标志 缺省值=FALSE */LPTSTR StrTrimLeft(LPTSTR sSrcStr,BOOL bNotCutCrLf = FALSE);/** @Prototype: LPTSTR StrTrimRight(LPTSTR sSrcStr, BOOL bNotTrimCRLFChar=FALSE) * @Description: 清除字符串右边空白 * @Parameter: LPTSTR sSrcStr 原始的字符串 * @Parameter: BOOL bNotTrimCRLFChar 清除回车换行符标志 缺省值=FALSE */LPTSTR StrTrimRight(LPTSTR sSrcStr,BOOL bNotCutCrLf = FALSE);/** @Prototype: inline LPTSTR StrTrim(LPTSTR sSrcStr, BOOL bNotTrimCRLFChar=FALSE) * @Description: 清除字符串左右边空白 * @Parameter: LPTSTR sSrcStr 原始的字符串 * @Parameter: BOOL bNotTrimCRLFChar 清除回车换行符标志 缺省值=FALSE */inline LPTSTR StrTrim(LPTSTR sSrcStr,BOOL bNotCutCrLf = FALSE) { return StrTrimRight(StrTrimLeft(sSrcStr,bNotCutCrLf),bNotCutCrLf); }/** @Prototype: LPTSTR StrRemoveSpace(LPTSTR sSrcStr, BOOL bNotTrimCRLFChar=FALSE) * @Description: 清除字符串中所有的空白 * @Parameter: LPTSTR sSrcStr 原始的字符串 * @Parameter: BOOL bNotTrimCRLFChar 清除回车换行符标志 缺省值=FALSE */LPTSTR StrRemoveSpace(LPTSTR sSrcStr,BOOL bNotCutCrLf = FALSE);/** @Prototype: LPTSTR StrRemoveSpace(LPTSTR sSrcStr, char ch) * @Description: 清除字符串中所有指定的单个字符 * @Parameter: LPTSTR sSrcStr 原始的字符串 * @Parameter: char ch 要移除的字符 */LPTSTR StrRemoveChar(LPTSTR sSrcStr,char ch);/** @Prototype: LPTSTR StrReplaceChar(LPTSTR sSrcStr, char ch) * @Description: 替换字符串中所有指定的单个字符 * @Parameter: LPTSTR sSrcStr 原始的字符串 * @Parameter: char ch 要替换的字符 */LPTSTR StrReplaceChar(LPTSTR sSrcStr,char chFind = ' ',char chReplace = '0');/** @Prototype: LPTSTR (LPTSTR sSrcStr,LPTSTR sFind,LPTSTR sReplace) * @Description: 替换字符串中所有指定的单个字符 * @Parameter: LPTSTR sSearch 原始的字符串 * @Parameter: LPCSTR sFind 要替换的字符 */LPTSTR StrReplaceStr(LPTSTR sSrcStr,LPTSTR sFind,LPTSTR sReplace);/** @Prototype: LPTSTR StrStrExt(LPTSTR sSearch,LPCSTR sFind) * @Description: 查找含汉字串中所有指定的串 * @Parameter: LPTSTR sSearch 原始的字符串 * @Parameter: LPCSTR sFind 要查找的字符 */LPTSTR StrStrExt(LPTSTR sSearch,LPCSTR sFind);/** @Prototype: int StrStrTimes(LPTSTR sSearch,LPCSTR sFind) * @Description: 查找含汉字串中所有指定的串出现的次数 * @Parameter: LPTSTR sSearch 原始的字符串 * @Parameter: LPCSTR sFind 要查找的字符 */int StrStrTimes(LPTSTR sSearch, LPCSTR sFind);/** @Prototype: CString AmountToStr(double dValue) * @Description: 转换金额为大写 * @Parameter: double dValue 金额值 */CString AmountToStr(double dValue);/** @Prototype: CString StrCurrentTime(LPCSTR sDateFormat) * @Description: 获取当前时间串 * @Parameter: LPCSTR sDateFormat 日期时间格式串:Y-年 M-月 D-日 H-时 M-分 S-秒 */CString StrCurrentTime(LPCSTR sDateFormat);/** @Prototype: CString StrCopyExt(LPCSTR sSrcStr,int nSize,char cFiller,BOOL bTail) * @Description: 转换串为确定长度的串 * @Parameter: LPCSTR sSrcStr 要复制的原始字符串 * @Parameter: int nSize 要复制的长度 * @Parameter: char cFiller 要填充的字符 * @Parameter: BOOL bTail 要填充的字符 DEFAULT=TRUE */CString StrCopyExt(LPCSTR sSrcStr,int nSize,char cFiller = ' ',BOOL bFillAtTail = TRUE);/** @Prototype: CString StrParseEnvName(LPCSTR sSrcStr) * @Description: 转换串中的环境变量 * @Parameter: LPCSTR sSrcStr 要替换的原始字符串(MAXSIZE=10k) */CString StrReplaceEnvName(LPCSTR sSrcStr);/** @Prototype: CString BinToHex(BYTE * sInpStr,int nSize) * @Description: 转换二进制串为十六进制串 * @Parameter: LPCSTR sSrcStr 要转换的原始字符串 * @Parameter: int nSize 要转换的长度 */ CString BinToHex(BYTE * sInpStr,int nSize);/** @Prototype: void HexToBin(LPCSTR sInpStr ,BYTE * sOutStr,int * nSize) * @Description: 转换十六进制串为二进制值 * @Parameter: LPCSTR sInpStr 要转换的原始字符串 * @Parameter: BYTE * sOutStr 输出的二进制值 * @Parameter: int * nSize 输出的长度 */ void HexToBin(LPCSTR sInpStr ,BYTE * sOutStr,int * nSize = NULL);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -