字符查找函数
//查找字符串中指定字符第一次出现的位置
LPTSTR StrChr( LPCTSTR lpStart,TCHAR wMatch)//区分大小银档弯写
char *strchr( const char *string, int c )
wchar_t *wcschr( const wchar_t *string, wchar_t c )
蠢洞 LPTSTR StrChrI( LPCTSTR lpStart,TCHAR wMatch)//不区分大小写
//查找字符串中指定字符最后一次出现的位置
LPTSTR StrRChr( LPCTSTR lpStart,LPCTSTR lpEnd,TCHAR wMatch)//区分大小写
char *strrchr( const char*string, int c )
wchar *wcsrchr( const wchar_t *string, int c )
LPTSTR StrRChrI( LPCTSTR lpStart,LPCTSTR lpEnd,TCHAR wMatch)//不区分大小写
*注 StrRChr()函数可以通过StrChr()函数和while循环来实现
补充:
查找字符串:
_tcsstr(........)
字符串转化为double型数字
锋闷 _tcstod( const char *nptr, char **endptr )
字符串转化为double型整数(只取整数部分,不取小数)Convert strings to a long-integer value.
_tcstoul ( const char *nptr, char **endptr, int base )
_tcstol ( const char *nptr, char **endptr, int base )
取子字符串
Extracts a substring of length nCount characters from this CStringT object, starting at position iFirst (zero-based).
CStringT Mid(
int iFirst,
int nCount
) const
CStringT Mid(
int iFirst
) const
example:
//typedef CStringT <TCHAR, StrTraitATL <TCHAR >>CAtlString
CAtlString s( _T("abcdef") )
_ASSERT( s.Mid( 2, 3 ) == _T("cde") )
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)