VC里面如何拆分含汉字与字母的字符串写入IC卡中(100分)

  • 主题发起人 superego
  • 开始时间
S

superego

Unregistered / Unconfirmed
GUEST, unregistred user!
在网上搜索了一下,都是下面的这段代码,但没有用
void CAaaView::OnButton1()
{
// TODO: Add your control notification handler code here
CString ChargeItemName;
CString aa = "9494858受得失测试585858585888d888888888888888";
int len=0;
ChargeItemName=InterceptString(len,aa);
AfxMessageBox(ChargeItemName);

len=ChargeItemName.GetLength();
ChargeItemName=aa.Mid(len);
AfxMessageBox(ChargeItemName);
}
CString CAaaView::InterceptString(int qlen, CString strSource)
{
int len,i,y;
CString sTemp,sreturn,ceshi;
strSource.TrimLeft();strSource.TrimRight();
len=strSource.GetLength();
y=0;
sTemp=strSource.Right(len-qlen);


for(i=0;i<len;i++)
{
if(sTemp[y]<0 || sTemp[y]>255)
y=y+2;
else
y=y+1;
if(y>=26)
break;
}
ceshi.Format("%d",y);
AfxMessageBox(ceshi);
sreturn=sTemp.Left(y);

return sreturn;
}
 
哪位大侠帮个忙吧,发了两次贴了,可没有一人回答呀
 
CString srcbuf // saves your source data
CString han, ascii // saves your dest data
WCHAR wc // stands for single 2-byte char
srcbuf = L"8949485受得失测试585858585888d888888888888888"
// 分流处理汉字&ascii char
for (int i = 0 i < srcbuf.GetLength() i++)
{
wc = srcbuf.GetAt(i)
if (HIBYTE(wc)) han += wc
else
ascii += wc
}
 
顶部