Programming Tips - How can I convert a path to for Linux-style forward slashes

Date: 2014jan12 Language: Java Q. How can I convert a path to for Linux-style forward slashes or Windows-style backward slashes? A.
String toForwardSlashes(String s) { return s.replace("\\", "/"); } String toBackwardSlashes(String s) { return s.replace("/", "\\"); }