Does Java impose any extra restrictions of its own. Windows (upto Vista) does not allow names to include
\ / < > ? * :
I know HOW to validate names (a regular expression).
I need to validate filenames entered by users.
My application does not need to run on any other platform, though, of course, I would prefer to be platform independent!
No, you can escape any character that Java doesn't allow in String literals but the filesystem allows.
Also, if trying to port an Windows app to Mac or Unix it is best to use:
File.separator
To determine the correct file separator to use on each platform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With