com.simpligility.maven.plugins.android.common.FileNameHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-maven-plugin Show documentation
Show all versions of android-maven-plugin Show documentation
Maven Plugin for Android Development
The newest version!
package com.simpligility.maven.plugins.android.common;
/**
* FileNameHelper can make a valid filename.
*
* @author alexv
*/
public class FileNameHelper
{
// { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':' };
private static final String ILLEGAL_CHARACTERS_REGEX = "[/\\n\\r\\t\\\0\\f`\\?\\*\\\\<>\\|\":]";
private static final String SEPERATOR = "_";
public static String fixFileName( String fileName )
{
return fileName.replaceAll( ILLEGAL_CHARACTERS_REGEX, SEPERATOR );
}
}