void CTestaDlg::GetCStringItemAt(CString strin,CString & strout,int nindex)
{ 
    char* p=strin.GetBuffer(strin.GetLength()+1);
    int n=0;
    char r[4]={'\0'};
    while(*p)
    { 
        if(n==nindex)
        {//找到第index个字符,以p开始的字符串指针 
            if (*p>=0x80||*p<0)
            {
                memcpy(r,p,2);
                //temp=*p;
            }else{
                memcpy(r,p,1);
            } 
            strout=r; 
            return ;
        }
 
        if(*p>=0x80||*p<0)
        {
            p++;//过滤汉字半字节
        }
        n++;
        p++;
    }
}

 demo下载,请猛击此处

相关文章:

  • 2022-02-10
  • 2021-09-05
  • 2021-12-29
  • 2021-10-16
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
猜你喜欢
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
相关资源
相似解决方案