Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: GNU General Public License 

public class Main {
    /**
     * sanitize the filename
     * @param fileName
     * @return
     */
    static String validateFileName(String fileName) {
        if (fileName == null)
            return null;
        fileName = fileName.replace('/', '_');
        fileName = fileName.replace('<', '_');
        fileName = fileName.replace('>', '_');
        fileName = fileName.replace(':', '_');
        fileName = fileName.replace('\'', '_');
        fileName = fileName.replace('?', '_');
        fileName = fileName.replace('"', '_');
        fileName = fileName.replace('|', '_');
        fileName = fileName.replace('(', '_');
        fileName = fileName.replace(')', '_');
        fileName = fileName.replace('[', '_');
        fileName = fileName.replace(']', '_');
        fileName = fileName.replaceAll("%", "");
        return fileName;
    }
}