is Valid File Name - Android java.io

Android examples for java.io:File Name

Description

is Valid File Name

Demo Code


//package com.java2s;

public class Main {
    public static boolean isValidSaveName(String fileName) {

        int len = fileName.length();
        for (int i = 0; i < len; i++) {
            char c = fileName.charAt(i);

            if (c == '\\' || c == ':' || c == '/' || c == '*' || c == '?'
                    || c == '"' || c == '<' || c == '>' || c == '|'
                    || c == '\t' || c == '\n') {
                return false;
            }//from  w w w  . j  a va  2 s . com
        }
        return true;
    }
}

Related Tutorials