码迷,mamicode.com
首页 > 其他好文 > 详细

从长字符串中获取想要的字符串

时间:2018-08-23 21:01:48      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:print   输出   字符串   strcpy   ring   str   int   bsp   inter   

 

char hh[512]={0};

strcpy(hh,"PrinterSerialNumber:G11404;PrinterStatus");

string str;
str=hh;
str=str.replace(str.find("PrinterSerialNumber:"),strlen("PrinterSerialNumber:"),"");
str=str.replace(str.find("PrinterSerialNumber:"),strlen(";PrinterStatus"),"");

 

输出结果为:G11404

从长字符串中获取想要的字符串

标签:print   输出   字符串   strcpy   ring   str   int   bsp   inter   

原文地址:https://www.cnblogs.com/Pond-ZZC/p/9525971.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!