List of utility methods to do File Name Create
String | toFilename(String key, final String suffix) to Filename String filename = key.substring(key.lastIndexOf("/") + 1); filename = filename.substring(0, filename.length() - suffix.length()); return filename; |
String | toFileName(String moduleName) Returns the file name implementing the module. return moduleName + ".js"; |
String | toFilename(String name, String extension) to Filename return toFilename(name, "", extension); |
String | toFilename(String s) Invokes toLowerCase(), converts all whitespaces to underscores and removes all characters other than a-z, 0-9, dot, underscore or minus. s = s.toLowerCase(); s = s.replaceAll("\\s+", "_"); s = s.replaceAll("[^a-z_0-9.-]", ""); return s; |
String | toFileName(String s) Replaces all the special characters in s string with an underscore return s.replaceAll("[^A-Za-z0-9_]", "_"); |
String | toFileName(String str) Change "Text Extractor Worker" or "Text extractor worker" to "TextExtractorWorker". StringBuilder sb = new StringBuilder(); boolean toUpper = true; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == ' ') { toUpper = true; continue; } else if (toUpper) { ... |
String | toFilename(String str) to Filename return str.replaceAll("\\s", "_").replaceAll(":", "_"); |