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 replaceAll (..)

  query = Query.replace (":", "\\:");  

Because 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

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -