Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1230|回复: 0
打印 上一主题 下一主题

Qt正则表达式替换

[复制链接]

1228

主题

1997

帖子

7582

积分

认证用户组

Rank: 5Rank: 5

积分
7582
跳转到指定楼层
楼主
发表于 2021-6-17 16:11:29 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
  1.   QRegExp toFindfileVersion("\"fileVersion\":(\\d+)");
  2.             //QStringList listFileVersion;
  3.             toFindfileVersion.indexIn(responseBody, 0);
  4.             //int pos = 0;
  5.             //while ((pos = toFindfileVersion.indexIn(responseBody, pos)) != -1)
  6.             //{
  7.             //    listFileVersion << toFindfileVersion.cap(1);
  8.             //    pos += toFindfileVersion.matchedLength();
  9.             //}
  10.             responseBody.replace(toFindfileVersion, "\"fileVersion\":\"\\1\"");
复制代码
把下面的json串
  1. {"result":{"resultCode":"0","InfoList":[{"fileVersion":1514682649480225715},{"fileVersion":1514682649480221234}]}}
复制代码
替换为
  1. {"result":{"resultCode":"0","InfoList":[{"fileVersion":"1514682649480225715"},{"fileVersion":"1514682649480221234"}]}}
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-4 02:31 , Processed in 0.057291 second(s), 19 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表