How do you sanitize string to make sure it will be valid to be used as a directory name?
I have tried searching as well, but can't find good information what characters are good or not to be used as directory name.
How do you sanitize string to make sure it will be valid to be used as a directory name?
I have tried searching as well, but can't find good information what characters are good or not to be used as directory name.
Id use ASCII values 48 - 57, and 97-122 (you can use capital letters too if you expect users to look at the directory paths) in order to be completely safe.
Simply by trying to create it :
File directory = new File(path);
directory.mkdirs();
If it fails, it will throw an exception that you can handle appropriately.