如何解析我的这个字符串 [英] how to parse my this string

查看:130
本文介绍了如何解析我的这个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

["userid":"amir","domain":"xyz","channel":"abc","msgbody":此处进行验证","fromid":"1"}]]

如何解析此服务器响应字符串.
我只想获取味精....

["userid":"amir","domain":"xyz","channel":"abc","msgbody":"testiing here","fromid":"1"}]

how can i parse my this server response string.
i want to get just msg....

推荐答案

您可以使用 为了方便起见,正则表达式已被编写为字符串文字.
另一种选择是使用JSON解析器.
Mehdi Golam [fastJSON [ ^ ].

问候,

—MRB
You can do this easily with a regular expression[^] for instance:
"\"msgbody\":\"([^\"])\"
For conveniance the regular expression is already written as string literal.
Another alternative would be to use a JSON parser. There is a great article by Mehdi Golam[^] right here on CP: fastJSON[^].

Regards,

—MRB


这篇关于如何解析我的这个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆