How to format a number to "+0000000000.123,45"

Hi! my name is Jorge. My problem is that I need to format a number to a extrange format. I know how to change the decimal point, the number of integer and fraction, etc.
But the problem is I want the number with N zeros at the begining but only with decimal point if there are digit. And I need the sign always appear, if it is a minus or a plus.
For example:
123,456.789 -> +0000000000123,456.789
-1,234,567.890 -> -00000000001,234,567.890
It is possible using a pattern. There is someone who show me how, because I can't find it the rigth pattern.
Thank you very much,
Jorge.

Here play with this - you'll need to tidy it up a bit for numbers under a 1000 or a million - maybe a parseInt function // * here would do it - Anyway, its a start. I've written it in a drag 'n' drop style so you can test and play first beofre applying it. Thats what I usually do - though I seem to recall java programmers think that 'drag-n-drop' is a dirty term - NO OFFENCE GUYS _ I'M NEW !!!
import java.text.*;
public class Decimal_Fmt {
public static void main (String []args) {
double d = Double.parseDouble(args[0]);
DecimalFormat fmt = new DecimalFormat("#0"+","+"000"+","+"000.0#####");
// * Possibly add a function call here ? *
String d_str = fmt.format(d);
System.out.println("DecimalFormat: "+d_str);
}

Similar Messages

  • How to Format a number to support multiple languages

    I am trying to format a number so that it shows up with the corret decimal separators and thousands separators for different regions/languages, but can't seem to.
    123456.223 is 123,456.223 (US English) and 123 456,223 in French (France)
    I don't know how many such regional settings are being used and what the decimal and thousands separators are.
    If you set the Format to 'System Default Number Format', all is well (But I have to live with 2 digits after the decimal). However, if I want to customize it by saying choosing one of the preset formats or using 'Customize'(say 3 digits after the decimal, for example), then, if I am designing the report in US English setting, the separators from that setting are used, even when the report is generated in French locale. Even if I try to put in a condition for these separators and use 'DefaultAttribute', it doesn't seem to help.
    One workaround is to format the number as a string and display the string instead (this time use ToText() function and provide the no. of decimal places needed). But I have aggregations based on this field and they don't work in with string fields.
    Could someone advise me if there is a way to solve this problem? (I'm hoping that there is some way, perhaps an easy one to overcome this problem.) It seems anytime I want to change the default setting, the current values are stored and used irrespective of the reigonal setting.
    Any help is greatly appreciated.
    Thank you,
    Raghu

    Use the default settings and then it should format according to the local PC settings.

  • How to FORMAT a number field in Formula editor

    Dear All,
    I have a "QUANTITY" field in database which has to get displayed in the report as " QTY : " that  will look like QTY : 54.
    Where as now it coming as QTY : 54.00
    So, how to format this field in the Formula Editor while concatenation of
    "QTY : " + CStr()
    If any one has any idea please help me out.
    Thanks and regards.

    Hi friends,
    Thanks to all of you that you all have replied my question and given your answers.
    Thanks to all of you specially Alpana Phapale, Wallie Chang, Poonam Thorat and Raghavendra Gadhamsetty, the answers given by you is the perfect one may be in different ways and only one can be used by me. But your answers were exactly correct.
    Thanks to Asha Lund, your answers is also correct but the result as per my report should be in figures and not in words.
    Whatever it may be but for repling thanks to you too.
    Please be always with me, I am very new to Crystal Report and just learnt by my own as my Boss ordered me to do this and I have to make about 50 reports within 15 days. I think the day will start from today.
    Well friends thanks a lot again for all your effort.

  • How to format large number field in XML so that it appears as is in Excel

    Hi
    I need help in formating the number field so that the number displays completely in Excel.
    Ex: 12345678889453 and this appers in Excel as 1.23457E+13
    Please let me know if you have any idea on this.
    Thanks

    Hi friends,
    Thanks to all of you that you all have replied my question and given your answers.
    Thanks to all of you specially Alpana Phapale, Wallie Chang, Poonam Thorat and Raghavendra Gadhamsetty, the answers given by you is the perfect one may be in different ways and only one can be used by me. But your answers were exactly correct.
    Thanks to Asha Lund, your answers is also correct but the result as per my report should be in figures and not in words.
    Whatever it may be but for repling thanks to you too.
    Please be always with me, I am very new to Crystal Report and just learnt by my own as my Boss ordered me to do this and I have to make about 50 reports within 15 days. I think the day will start from today.
    Well friends thanks a lot again for all your effort.

  • How to format a number to a correct decimal places

    i wanted to format a number to a correct decimal places say for example
    666.105 t0 666.11 please any body help us

    whether to use NumberFormat or DecimalFormat can u give me example thanks

  • Web app Number field: How to format a number as currency in Business catalyst

    Not a coder. I have a Number field I have created in my web app, please how can I format this field to display the figures like this 999,999,999,999 (#120,000,000) random figure. Help will be appreciated.

    You can't. Number type field is there for storing integers. 999,999,999,999
    is not an integer. You need to use text string. Unless you're using the
    field inside the search form, in which case you need to use JavaScript to
    format the content of the field on the frontend.
    Cheers,
    Mario

  • IR - 9.2 - how to format a number to a textfield in dashboard

    Hello,
    i am going to develop an individual Dashboard with free positionung textfields, almost all works, but how can i formatting the numbers?
    here the script:
    var Ausfall=ActiveDocument.Sections["Ergebnisse"].Columns["Ausfall"].GetCell(1);
    var AB=ActiveDocument.Sections["Ergebnisse"].Columns["A B"].GetCell(1);
    var ABprozw=AB/Ausfall;
    AnzeigeABProz.Text=ABprozw; /* is a free positioning textfield in dashboard */
    in the dashboard ist the value shown as
    0.7793775542282301
    but how can i get a number format as:
    0,78
    or
    78,9%
    are there any convert/formating function (to dashboard-textfields) in IR ?
    mfg
    Jens Rohloff

    If you want the Percent signt o show up then you will need to treat the number as a string.
    Another option
    var ABprozw=AB/Ausfall * 100;
    var ABprozw = Math.round(ABprozw)
    var ABprozw = ABprozw/100
    This will give you tne 0.78
    Wayne Van Sluys
    TopDown Consulting

  • How to format a number datatype

    I had a report which uses a text field. In that text field included is a placeholder column that represents a datatype of number as &<CP_CAPITAL_BALANCE>. When I run it displays as:
    Capital Balance of 3423548.00 as of ...
    It should be formated into 3,423,548.00
    Thanks,
    Warren

    Hi,
    you can choose your desired number format by setting the "Format Mask" property of you text field (e.g. NNNGNNNGNNNGNN0D00).
    N = not mandatory digit
    0 = mandatory digit (in this way you always have two decimal digits)
    G = group separator
    D = decimal separator
    Hope this helps you
    Bye
    Raffy

  • How to format a number ?

    Hi
    I have some numbers: 0,3,24,118
    And I want to print them with a 3-digit format: 000,003,024,118
    How do I do this ?
    Thanks

    There's a NumberFormat class, but this method will do:String format (int i) {
        String str = Integer.toString (i);
        while (str.length () < 3) {
            str = "0" + str;
        return str;
    }Kind regards,
      Levi

  • How to format page number layout in TOC

    I am using the automatic TOC function in Pages to make a table of contents for my thesis.  It looked great at first, but when I changed the page margins all the of the page numbers moved to be next to the text section headers and in some cases, bumped down to the next line.  I can't seem to change this so that all the page numbers are right-justified as they were when the TOC was originally generated.  I've tried removing the TOC and starting from scratch, but I still have the same problem.  Just to clarify: I have set "styles" to control the text formatting and indentation for each TOC level.  My question is how to designate the proper margins and orientation for the automatically-generated page numbers.  Any insight would be appreciated.

    Never mind!  I found the solution here:
    https://discussions.apple.com/message/2919972#2919972

  • How to format 9 or 11 digit number with dashes

    Windows Adobe Pro 9.
    Someone please be kind and have mercy on me, I've researched this issue for 5 hours now and cannot resolve it on my own.
    I have a text field where the user will enter either a 9 digit or 11 digit number separated with dashes. If the number entered is 9 digits, it should appear as
    XX-XXXXXXX. If 11 digits, it should appear as XX-XXXXXXX-XX. If only 9 digits are entered, the -XX at the end must be omitted.
    I found a javascript that showed how to allow a varying number of digits, and I also found one that showed how to cause the dash to be entered, but I'm not smart enough to know how to combine the two. I've only used one other javascript before (how to format the time 12:00 am, with a gigantic thanks to Mr. George Johnson), so I know that I must put the script in "Advanced > Document Processing > Document JavaScripts." I think then I would go into the text field format and select "custom," and enter a keystroke and format script???
    Any help will be greatly appreciated.
    thanks
    alice

    Hi Mr. Johnson,
    When I copied the first part of the code into the document-level javascript editor box and hit okay, it gives this message:
    SyntaxError: return not in function
    8: at line 9
    and the cursor moves to the empty line after:
       // Do nothing if field is blank
        if (!s) return;
    Is there something missing?
    I really appreciate your help.
    alice

  • How to ignore/remove number format mask ?

    Hi
    I have to import some numbers from the excel sheet, and that number has been saved along with the format mask like (9,999.99) (2,000.00,1,500,00,......)
    but that field in my table is a number filed and i have to equal that number with the number that exist in my table
    i have write that relation like
    mytable.filed1=to_number('excel_filed',9,999.000)
    but I does not work
    So what the solution for that
    Thank you

    Double post. See How to remove a number format mask ?

  • How to lpad and format a number column

    Hi,
    I have a requirement to format a number column and then lpad with '*' to 12 characters. For example if the column value is 1234560 then i have to display it as *****1,234,560.00. I tried using <?xdofx:lpad(format-number:AMOUNT;'999G999D99',12,'*')?> and <?xdofx:lpad(to_char(AMOUNT,'999,999,99.99'),12,'*')?>.
    Can any1 suggest me how to lpad and format the value.
    Thanks in advance.

    Hi,
    Use the following syntax for the lpad function, and use the MS word format mask for the formatting part. <?xdofx:lpad(AMOUNT,12,'*')?>

  • How can I format the number in ?shape-text:

    Hi All,
    I am using shapes in the rtf template. I need to format the number which is used in the shape as
    <?shape-text:mytagname?>
    now mytagname has inconsistent values in the xml like 3, 4.5, 3.55. I want to format this to two digits after decimal i.e 0.00 format.
    How can I format the number in <?shape-text: ???
    Regards,
    Amit Deshpande
    Persistent Systems Ltd

    Hi Amit,
    <?shape-text:format-number(4.5,'#,##0.00')?>

  • Has someone knowlege of how to use Custom Number Format in Numbers V3.0

    Hello Everyone,
    From Excel to Numbers '09 I worked with Custom Number Format.
    Making formats like 60 sec, km/h or m/s².
    In the new Version 3.0 it is not under 'Format'/Custom Number Format.
    I did not find it! Has someone found a way to do it the old way.
    I am working with the German version.
    Bye

    Limmy,
    There is no option in Numbers 3.0 for Custom Format. If that is mandatory for your purposes, it is still available in Version 2.3.
    Jerry

Maybe you are looking for

  • How to pass fields in task description so that it will come in  sap inbox

    Hi all. (<b>very urgent)</b> I am doing one workflow on vendor payment workflow. I want to pass some fields in the task description so that that they  will come in the user decision description. Pls help me solving this. Please replyif more clarifica

  • Volume not saving in the Window's volume mixer. Resets back to 100% [Adobe Flash Player]

    This problem is rustling my jimmies hardcore Everytime I restart Firefox or Internet Explorer "Adobe Flash Player 11.3" always resets back to 100% in the Window's volume mixer while everything else stays put. My Skype volume never resets after a rest

  • Invalid B-tree node and disk stuck

    Last night my 2 year old iMac froze up. When I re-started I received the flashing question-mark folder. I ended up inserting my OS X install disk and attempting to run the Disk Utility. I tried to repair the disk, but got the "Invalid B-tree node siz

  • CRM ORDER CHANGE AND STATUS MANAGEMENT - workflow

    Hi, We have created a Changed method for bus2000120 which is configured to fire when the Order is saved via Status Management.  We have added an entry to BSVW for the object, bus2000120.changed with no restrictions.  We have also created a function m

  • I'm having issues with syncing my music.

    Recently, I upgraded my computer to Windows 7, from Vista. I've recovered all my music, and ringtones from my old windows. Supposedly authorised my new Windows for syncing. I currently have 19 GBs of music on my phone, which I'm reducing to 16.2 GBs.