From NumberFormat to string pattern

Discussion in 'Java' started by HEP, Mar 1, 2006.

  1. HEP

    HEP Guest

    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
    HEP, Mar 1, 2006
    #1
    1. Advertising

  2. HEP

    HEP Guest

    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
    HEP, Mar 1, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kiran
    Replies:
    2
    Views:
    5,141
    kiran
    Nov 2, 2005
  2. Joe Pribele

    rounding numberformat

    Joe Pribele, Aug 19, 2003, in forum: Java
    Replies:
    2
    Views:
    2,973
    Frank
    Aug 20, 2003
  3. mtp
    Replies:
    2
    Views:
    391
  4. Scott Smith
    Replies:
    4
    Views:
    1,066
  5. StephaneLeFou

    NumberFormat vs double and long

    StephaneLeFou, Jun 11, 2008, in forum: Java
    Replies:
    4
    Views:
    405
    StephaneLeFou
    Jun 12, 2008
Loading...

Share This Page