From NumberFormat to string pattern

H

HEP

Hello,

it is possible to do:

String pattern = ...;
DecimalFormat df = new DecimalFormat(pattern);

but is it possible to do the opposite like in:

df.setGroupingSize(3);
pattern = df.getPattern();

the "getPattern()" method does not exist, but maybe there is another way
to get it back. The reason is that we need to serialize this format in
our XML format, so i can't (don't want to) use the Java serializer since
it would require to modify our XML DTD.

Any idea? TIA
 
H

HEP

HEP a écrit :
Hello,

it is possible to do:

String pattern = ...;
DecimalFormat df = new DecimalFormat(pattern);

but is it possible to do the opposite like in:

df.setGroupingSize(3);
pattern = df.getPattern();

the "getPattern()" method does not exist, but maybe there is another way
to get it back. The reason is that we need to serialize this format in
our XML format, so i can't (don't want to) use the Java serializer since
it would require to modify our XML DTD.

Any idea? TIA

df.toPattern();

sorry, i'm blind
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top