相关疑难解决方法(0)

在Windows上验证文件名

public static boolean isValidName(String text)
{
    Pattern pattern = Pattern.compile("^[^/./\\:*?\"<>|]+$");
    Matcher matcher = pattern.matcher(text);
    boolean isMatch = matcher.matches();
    return isMatch;
}
Run Code Online (Sandbox Code Playgroud)

此方法是否保证Windows上的有效文件名?

java regex windows string filenames

55
推荐指数
8
解决办法
3万
查看次数

标签 统计

filenames ×1

java ×1

regex ×1

string ×1

windows ×1