Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个需要解析的 QString。这个 QString 是一个从 URL 获得的 QNetworkReply 对象。
<label id='Today_LastSale1'>$ 21.2401</label>
我需要来自 QString 的值 21.2401。
我试过这个。
QRegExp rx("<label id='Today_LastSale1'>$ (\\d)</label>");
但它返回-1。需要帮助。
提前致谢!
您可以尝试删除非数字和“。” 字符串中的字符。尝试用这个表达式替换正则表达式:"[^0-9\.]"
"[^0-9\.]"
QRegExp rx("[^0-9\\.]"); yourString.replace(rx, "");