String (String fName) { if (fName != null) { fName = NON_ALPHANUM.matcher(fName).replaceAll("."); // collapse repeating dots fName = REPEATING_DOTS.matcher(fName).replaceAll("."); // drop leading and trailing dots final int len = fName.length(); if (len > 0) { final int start = fName.startsWith(".") ? 1 : 0; final int end = fName.endsWith(".") ? len - 1 : len; if (start > 0 || end < len) { fName = fName.substring(start, end); } } } return fName; }