In Java is there a way to retrieve the format string from a Format object (or any derived classes)
In code:
Format f = new DecimalFormat("$0.00");
System.out.println(???);
Is there something I can use to get System.out.println(???); to print "$0.00".
I looked at toPattern(); but that function doesn't appear in the abstract Format class and the variable I'm working with can be anything that extends Format.
The pattern (if there is any at all) depends on the subclass of Format. There is no guarantee that a Format would even use a pattern for its formatting.
Edit: I'm not sure what you're trying to do, but if you need to persist a Format instance, it is Serializable.
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