Here you can find the source of removeSurplusSeparator(String str)
public static String removeSurplusSeparator(String str)
//package com.java2s; import java.io.File; public class Main { public static String removeSurplusSeparator(String str) { String sepStr = File.separator; return str.replaceAll(sepStr + sepStr, sepStr); }//from w ww . j a va2s . co m }