:"{ -> :{
}"} -> }}
< /code>
Как будет искать шаблон для этого?{"method":"createInvoice","params":"{"btcDue":null,"btcPaid":null,
"btcPrice":null,"currency":"PLN","currentTime":null,
"exceptionStatus":null,"expirationTime":null,
"guid":"99250130","id":null,"invoiceTime":null,
"paymentUrls":null,"price":1.23,"rate":null,
"status":null,"transactions":null,"url":null
}"}
< /code>
Но предположим, что у нас будет больше случаев, чтобы заменить, как 2

для уточнения: Android String Methods < /strong> < /p>
public String replace(CharSequence target, CharSequence replacement) {
String replacementStr = replacement.toString();
String targetStr = target.toString();
// Special case when target == "".
// .. cut
// This is the "regular" case.
int lastMatch = 0;
StringBuilder sb = null;
for (;;) {
int currentMatch = indexOf(this, targetStr, lastMatch);
if (currentMatch == -1) {
break;
}
if (sb == null) {
sb = new StringBuilder(count);
}
sb.append(this, lastMatch, currentMatch);
sb.append(replacementStr);
lastMatch = currentMatch + targetStr.count;
}
if (sb != null) {
sb.append(this, lastMatch, count);
return sb.toString();
} else {
return this;
}
}
public String replaceAll(String regex, String replacement) {
return Pattern.compile(regex).matcher(this).replaceAll(replacement);
}
Подробнее здесь: https://stackoverflow.com/questions/418 ... ted-string