问题描述
我有一个动态生成的字符串,该字符串基本上是JSON字符串.每次生成字符串时,字符串中的几个单词都会更改,我该如何解析这些单词,以便用自己的某个常量单词替换它们.
字符串看起来像这样
"end_location":{" Za ":17.44716," $ a ":78.37790999999993},"start_address":"Mumbai Rd,Madhura Nagar Colony,Madhapur,Hyderabad,Andhra印度普拉达什," start_location:{" Za :17.4243," $ a :78.37761999999998},
在此示例字符串之前和之后有更多数据.现在我得到的结果是Za和$ a(以粗体显示),它们总是不断更改为不同的值.我该如何用一个常数词替换这些词.
Hi,
I have a string which is generated dynamically, the string is basically an JSON string. Each time the string is generated few words in the string gets changing, how can i parse these words so that i replace them with some constant word of my own.
The string looks like this
"end_location":{"Za":17.44716,"$a":78.37790999999993},"start_address":"Mumbai Rd, Madhura Nagar Colony, Madhapur, Hyderabad, Andhra Pradesh, India","start_location":{"Za":17.4243,"$a":78.37761999999998},
With even more data before and after this sample string. Now the result what i get has Za and $a(in bold) which always keeps changing to different value. How can i replace these words with some constant word.
推荐答案
这篇关于动态字符串替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!