BOOL WINAPI change(HWND hwnd,LPCWSTR lpString)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
{
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
TCHAR *di[10] =
{_T("zero "),
_T("one "),
_T("two "),
_T("three "),
_T("four "),
_T("five "),
_T("six "),
_T("seven "),
_T("eight "),
_T("nine ")};
![](/Images/OutliningIndicators/InBlock.gif)
int nLen = wcslen(lpString);
![](/Images/OutliningIndicators/InBlock.gif)
wchar_t wcIndex;
CString strOne;
CString strSum = "";
for(int n = 0; n < nLen - 2; n++)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (lpString[n] >='0' && lpString[n] <= '9')
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
wcIndex = lpString[n];
//int index = _wtoi(&lpString[n]);
int index = _wtoi(&wcIndex);
![](/Images/OutliningIndicators/InBlock.gif)
//CString strIndex;
//strIndex.Format("%d",index);
//MessageBox(NULL,strIndex,"ooooo",0);
![](/Images/OutliningIndicators/InBlock.gif)
strOne = di[index];
}
strSum = strSum + strOne;
}
//Other Codes
}上面代码中,红色部分:
CString对象可以当作数组使用,对象名可以当作数组名,利用“[]”定位其中的字符。
但注意:当对象名当作指针用时,其返回的是整个字符串,而不可以返回指定的某个字符。
posted on 2012-12-25 13:25
寻步 阅读(937)
评论(0) 编辑 收藏 引用 所属分类:
C++概念