Java - Replacing characters in the string -


i'm trying write if statement checks if string contains character /.

if contained, replaced \\.

is there way that?

the concise way use replaceall() method of string , regular expression:

newstr = oldstr.replaceall("/", "\\\\"); 

Comments