1 package com.simpligility.maven.plugins.android.common; 2 3 /** 4 * FileNameHelper can make a valid filename. 5 * 6 * @author alexv 7 */ 8 public class FileNameHelper 9 { 10 // { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':' }; 11 private static final String ILLEGAL_CHARACTERS_REGEX = "[/\\n\\r\\t\\\0\\f`\\?\\*\\\\<>\\|\":]"; 12 private static final String SEPERATOR = "_"; 13 14 public static String fixFileName( String fileName ) 15 { 16 return fileName.replaceAll( ILLEGAL_CHARACTERS_REGEX, SEPERATOR ); 17 } 18 19 }