⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.h

📁 一个更为先进的嵌入式操作系统.采用RMS线程调度算法,具有信号量等同步对象.亦包括GUI. 通过该系统您可以极大知道Windows的内部秘密.
💻 H
字号:
// String.h: interface for the CString class.
//
//////////////////////////////////////////////////////////////////////

#ifndef _GOS_STRING_H
#define _GOS_STRING_H

#define strlen(psz) CString::StrLen(psz)

enum _tagString
{
	StrBufGrowSize=1016,
};

class CString  
{
public:
	void ReleaseBuffer(int nNewLength);
	LPTSTR GetBuffer(int nMinBufLength);
	void TrimLeft(LPCTSTR pszTarget);
	void TrimRight(LPCTSTR pszTarget);
	int Replace(TCHAR chOld, TCHAR chNew);
	int Replace(LPCTSTR pszOld,LPCTSTR pszNew);
	double toDouble();
	int toHex();
	int toInt();
	void Format(LPCTSTR pszFormat,...);
	void MakeLower();
	void MakeUpper();
	int FindOneOf(LPCTSTR pszCharSet);
	int ReverseFind(TCHAR ch);
	int Find(TCHAR ch,int nStart);
	int Find(LPCTSTR psz,int nStart);
	void Mid(CString& strOut,int nFirst);
	void Mid(CString& strOut,int nFirst,int nCount);
	void Right(CString& strOut,int nCount);
	void Left(CString& strOut,int nCount);
	int Compare(LPCTSTR psz,int nCount);
	void StrCpyN(LPCTSTR psz,int nCount);
	void StrCatN(LPCTSTR psz,int nCount);
	CString(){m_pData=NULL;}
	CString(const CString& str);
	CString(LPCTSTR psz);
	~CString();
public:
	static int StrLen(LPCTSTR psz);
	static int StrLenEx(LPCTSTR psz);
	static LPCTSTR StrAllocEx(LPCTSTR psz);
	static LPCTSTR StrReAllocEx(LPCTSTR pszOld,LPCTSTR pszNew,int nCount);
	static void StrFreeEx(LPCTSTR psz);
	int GetLength()const{return m_pData?AllocSize(m_pData)/sizeof(TCHAR)-1:0;}
	BOOL IsEmpty(){return !GetLength();}
	int Find(TCHAR ch){return Find(ch,0);}
	int Find(LPCTSTR psz){return Find(psz,0);}
	const CString& operator+=(LPCTSTR psz){StrCatN(psz,StrLen(psz));return *this;}
	const CString& operator+=(const CString& str){StrCatN(str.m_pData,str.GetLength());return *this;}
	const CString& operator=(LPCTSTR psz){StrCpyN(psz,StrLen(psz));return *this;}
	const CString& operator=(const CString& str){StrCpyN(str.m_pData,str.GetLength());return *this;}
	TCHAR operator[](int nIndex){return m_pData[nIndex];}
	BOOL operator==(LPCTSTR psz){return !Compare(psz,GetLength()+1);}
	BOOL operator==(const CString& str){return !Compare(str.m_pData,GetLength()+1);}
	operator LPCTSTR()const{return LPCTSTR(m_pData);}
private:
	static int fmtInt(TCHAR aBuf[],int nValue,int nSign);
	static int fmtHex(TCHAR aBuf[],int nValue,BOOL bUpper);
	static int fmtDouble(TCHAR aBuf[], double dValue,int nPrec,int nSign);
	LPTSTR m_pData;
};

#endif //_GOS_STRING_H

⌨️ 快捷键说明

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