BOOL WINAPI change(HWND hwnd,LPCWSTR lpString)


{

TCHAR *di[10] =
{_T("zero "),
_T("one "),
_T("two "),
_T("three "),
_T("four "),
_T("five "),
_T("six "),
_T("seven "),
_T("eight "),
_T("nine ")};

int nLen = wcslen(lpString);

wchar_t wcIndex;
CString strOne;
CString strSum = "";
for(int n = 0; n < nLen - 2; n++)

{
if (lpString[n] >='0' && lpString[n] <= '9')

{
wcIndex = lpString[n];
//int index = _wtoi(&lpString[n]);
int index = _wtoi(&wcIndex);

//CString strIndex;
//strIndex.Format("%d",index);
//MessageBox(NULL,strIndex,"ooooo",0);

strOne = di[index];
}
strSum = strSum + strOne;
}
//Other Codes
}上面代码中,红色部分:
CString对象可以当作数组使用,对象名可以当作数组名,利用“[]”定位其中的字符。
但注意:当对象名当作指针用时,其返回的是整个字符串,而不可以返回指定的某个字符。
posted on 2012-12-25 13:25
寻步 阅读(964)
评论(0) 编辑 收藏 引用 所属分类:
C++概念