永发信息网

mfc中怎么能获得两个空格间的字符,如“ab cd ef”,只要cd

答案:5  悬赏:20  手机版
解决时间 2021-02-27 08:06
  • 提问者网友:情歌越听越心酸
  • 2021-02-26 12:03
mfc中怎么能获得两个空格间的字符,如“ab cd ef”,只要cd
最佳答案
  • 五星知识达人网友:大漠
  • 2021-02-26 13:08
CString str = "ab cd ef";
int iPos = str.Find(" ");
CString str1 = str.Mid(iPos+1,str.GetLength()-iPos-1);
iPos = str1.Find(" ");
str1 = str1.Left(iPos);
全部回答
  • 1楼网友:青尢
  • 2021-02-26 17:29
我不怎么会使用MFC,所以字符串用char数组来存储,然后判断空格的编码
  • 2楼网友:老鼠爱大米
  • 2021-02-26 16:10
使用CString类。
  • 3楼网友:白昼之月
  • 2021-02-26 14:32
你好! CString str1 = "ab cd ef"; CString str2 = str1.Left(5);//取str1左侧的5个字符,即"ab cd" str2 = str2.Right(2);//取str2右侧的2个字符,即"cd" 我的回答你还满意吗~~
  • 4楼网友:人類模型
  • 2021-02-26 13:31
CString str1 = "ab cd ef"; CString str2 = str1.Left(5);//取str1左侧的211352615个字4102符,1653即版"ab cd" str2 = str2.Right(2);//取str2右侧权的2个字符,即"cd"
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯