stringtool.h

来自「一个HTTP协议的封装类」· C头文件 代码 · 共 43 行

H
43
字号
#pragma once

class StringTool
{
private:
	/*pSrc是否以pTarget开头*/
	static bool BeginWith(const char* pSrc,char* pTraget,int lowUp=0);
	
public:

	static int ERROR;
	static int SUCCESS;

	//7.0.441.400
	/*查找字符c在pSrc中第n次出现的位置,从0开始, -1未找到*/
	static int Find(const char* pSrc,char c,int n=1);

	/*查找字符串pTarget在pSrc中的位置 -1未找到,lowUp -1 表示tolower,1 表示touper*/
	static int Find(const char* pSrc,char* pTraget,int lowUp=0);

	/*查找pSrc中index和index左的字符放到pResult*/
	static int Left(const char* pSrc,char* pResult,int index);//pResult是输出参数,它在外部已分配好空间

	/*查找pSrc中index和index右的字符放到pResult*/
	static int Right(const char* pSrc,char* pResult,int index);

	/*查找pSrc中index和index右len-1个字符放到pResult*/
	static int Mid(const char* pSrc,char* pResult,int index,int len);

	/*把pSrc中的rSrc替换成rMent,结果放到pResult*/
	static int Replace(const char* pSrc,char* pResult,char* rSrc,char* rMent);

	/*字符串变成数字*/
	static float Str2Num(const char* pSrc);


	static float CalculateExperssion(const char* pSrc);

	/*
	找),找(,得到SubExp,
	找'*',找*左右的操作符,得到*的表达式,计算*法
	*/
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?