I want to generate file names from a mask in Java.
Something like 'Data-12-08-29-xxx.xml' from a mask like 'Data-${YY}-${MM}-${DD}-${var1}.xml'. I dont want to generate random file names, instead the file names would built according to a pattern provided at runtime.
I can imagine just what I need to create a nice, generic class that will handle this for all manner of cases, but I dont want to reinvent the wheel, if something exists out there that I can re-purpose and perhaps extend.
Any suggestions?
the Formatter
class (the functionality behind String.format()
) has a very powerful formatting syntax (much more powerful than MessageFormat). It can handle variable substitution as well as date formatting.
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