Skip to content

Instantly share code, notes, and snippets.

@daichan4649
Created October 23, 2013 04:56
Show Gist options
  • Save daichan4649/7112801 to your computer and use it in GitHub Desktop.
Save daichan4649/7112801 to your computer and use it in GitHub Desktop.
ファイル名チェック(禁則文字) for Android
public static boolean isAvailableFileName(String fileName) {
if (TextUtils.isEmpty(fileName)) {
return false;
}
// 次の9文字は使用不可(< > : * ? " / \ |)
final String regularExpression = "^.*[(<|>|:|\\*|?|\"|/|\\\\|\\|)].*$";
return !fileName.matches(regularExpression);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment