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

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -