Qt正则表达式替换
QRegExp toFindfileVersion("\"fileVersion\":(\\d+)");//QStringList listFileVersion;
toFindfileVersion.indexIn(responseBody, 0);
//int pos = 0;
//while ((pos = toFindfileVersion.indexIn(responseBody, pos)) != -1)
//{
// listFileVersion << toFindfileVersion.cap(1);
// pos += toFindfileVersion.matchedLength();
//}
responseBody.replace(toFindfileVersion, "\"fileVersion\":\"\\1\"");把下面的json串{"result":{"resultCode":"0","InfoList":[{"fileVersion":1514682649480225715},{"fileVersion":1514682649480221234}]}}
替换为{"result":{"resultCode":"0","InfoList":[{"fileVersion":"1514682649480225715"},{"fileVersion":"1514682649480221234"}]}}
页:
[1]