i need to get all the files ends with .doc and i have some custom extensions like .doc.25-40,
.doc2 etc..i need to get all the extensions with .doc.*
filename.endsWith(".doc.*");
fails why?
No, that doesn't work. Java doesn't support simple wildcards. You would have to use a Regex method, e.g.:
filename.matches(".*\\.doc.*")
Explanation:
.* // any text
\\. // a period
doc // "doc"
.* // any text
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