判断CString字符串中各位是数字,大小写字母,符号,汉字.xml

时间:2022-12-16 09:11:28

    // UNICODE字符集  
      
    CString str =  L"0123abc中文字符、/";    
      
    CString shuzi,biaodianfuhao,hanzi,daxiezimu,xiaoxiezimu;    
        
    for (int i = 0 ; i <str.GetLength();i++)    
    {    
     int unicode = (int)str.GetAt(i);    
     if (unicode <= "9" && unicode >= "0")    
     {    
      shuzi += str.GetAt(i);    
     }    
     else if (unicode <= "z" && unicode >= "a")    
     {    
      xiaoxiezimu += str.GetAt(i);    
     }    
     else if (unicode <= "Z" && unicode >= "A")    
     {    
      daxiezimu += str.GetAt(i);    
     }    
     else if (unicode > 255)    
     {    
      hanzi += str.GetAt(i);    
     }    
     else    
     {    
      biaodianfuhao += str.GetAt(i);    
     }    
    }    



本文使用 书画小说软件 发布,内容与软件无关,书画小说软件 更惬意的读、更舒心的写、更轻松的发布。

   >  >  >