Here you can find the source of cleanStringForFilename(String originalString)
public static String cleanStringForFilename(String originalString)
//package com.java2s; //License from project: Open Source License public class Main { public static String cleanStringForFilename(String originalString) { String string = removeSpaces(originalString); string = removeParens(string);/*from ww w . j av a2 s. com*/ return string; } public static String removeSpaces(String originalString) { return removeChar(originalString, ' '); } public static String removeParens(String originalString) { String string = removeChar(originalString, '('); string = removeChar(string, ')'); return string; } private static String removeChar(String originalString, char badChar) { String returnString = ""; char[] array = originalString.toCharArray(); for (int i = 0; i < array.length; i++) { char currentChar = array[i]; if (currentChar != ' ') { returnString += currentChar; } } return returnString; } }