I want to replace spaces from path string. I tried below but doesn't seems to be working :
String path = "/Users/TD/San Diego";
path=path.replaceAll(" ","\\ ");
System.out.println(path);
Goal is to convert
"/Users/TD/San Diego" to "/Users/TD/San\ Diego"
Any further space from string also needs to be replaced with "\ "