All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jayway.maven.plugins.android.common.FileNameHelper Maven / Gradle / Ivy

There is a newer version: 4.6.0
Show newest version
package com.jayway.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 );
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy