过滤文件名非法字符

来源:互联网 发布:苹果下载软件itunes 编辑:程序博客网 时间:2024/05/01 19:03

为了合理性,过滤文件名非法字符是必须的,果断地要干掉.....

windows现在已知的文件名非法字符有 \ / : * ? " < > |



private static Pattern FilePattern = Pattern.compile("[\\\\/:*?\"<>|]");public static String filenameFilter(String str) {return str==null?null:FilePattern.matcher(str).replaceAll("");}


0 0
原创粉丝点击