Escaping '\' for use with Java replaceAll method -
Replacement of the string class I am getting some strange results while using all the method.
The string query has the following: @ cm: name: "hello"
if I say query .replaceAll (":", "\\": ");
I hope the following results: @mm \: name \:" hello "
Instead I'm getting: @cm: name: "hello"
. Original content.
Do not use Because replaceAll (..)
query = Query.replace (":", "\\:");
string
is immutable - that is, if you If you call the method without conveying the result, then you do not get anything - the internal state of the object will not change.
Comments
Post a Comment