private static String removeSlashes ( String path ) { String retString = path ; String slash = System . getProperty ( "file.separator" ) ; //if non-Unix slashes replace retString = retString . replace ( slash , "/" ) ; retString = retString . replaceFirst ( "^/" , "" ) ; retString = retString . replaceFirst ( "/$" , "" ) ; return retString ; }
Removes leading or trailing slashes from a string .