Formatting a number

hi all,
help me out .. iam facing problem with formatting a text....
for ex: i want to format a number 34347.98 to 34'347.98 using NumberFormat class.... but iam not able to get it.
help me how to format above its very urgent....
thanks
Naresh G

Wouldn't a new DecimalFormat("##'###.##') do the trick?
kind regards,
Jos

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.

  • Format a number

    Hi,
    I need some help with formating a number.
    I am having a string object of format '00000' and i want to have it formatted to '000.00'
    Is there a way i can change it to double by specifying the format?
    Let me know if there is any way i can do it using Number format or Decimal format?

    Does this String come in any other flavors? Is it to represent currency? Myself, if this were currency, I'd read it in as an int and even save it and manipulate it as an int. Then when I wanted to display it, I'd divide by 100.00 and use a either a NumberFormat.getCurrencyInstance if it's currency, or else a DecimalFormat if not.

  • 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.

  • Apex 4.2: Date picker & format mask number

    Hello
    In Apex 4.2, in a Date Item, how can I modify the date picker to set Monday as the start of week day? I can set Monday as the start of week day on a calendar, but not in a Date Item.
    In a Number Item, there's no format mask to set the comma char as a decimal separator and the dot char as a thousand separator. How can I create a new format mask number?
    Thank you.
    Edited by: user7034195 on 12-mar-2013 3:24

    for the Date Item, you can check this link, you have to call the process on the page load
    http://stackoverflow.com/questions/1313317/set-start-day-of-the-week-in-jquery-ui-datepicker
    and for the Number format, there's a little trick involved, will try to explain
    First of all convert you items from Number field to simple Textfield.
    1. Write this in your items Post Calculation Computation: TO_CHAR (:item_name, '999G999G999G999G990D00', 'NLS_NUMERIC_CHARACTERS = '',.''')This will do the number formatting you want, but in oracle above format is not acceptable, so while submitting the above values to database we need to undo the changes for that you can use the below code.
    2. Create a Computation "After Submit" for every item you did the above formatting and copy this code in it: replace(replace('1.00.00,00','.',''),',','.') for the 2nd step you can create a package/function which will get the items value as string and do the conversion as number using above code and return back the number.
    This should help you.
    Regards,
    Tauceef

  • RE: (forte-users) Formatting a number

    Thank you. That worked out great.
    ka
    -----Original Message-----
    From: Thompson Ian [mailto:Ian.Thompsonicl.com]
    Sent: Friday, February 18, 2000 9:35 AM
    To: 'Amin, Kamran'; 'Forte User'
    Subject: RE: (forte-users) Formatting a number
    Ka,
    Try using TextFormat in combination with NumericFormat - like this:
    strfmt : TextFormat = new;
    numfmt : NumericFormat = new;
    number : IntegerData = new;
    numberastext : TextData;
    numfmt.Template='L0000000';
    strfmt.Template='A###-####';
    number.SetValue(source = 23456);
    // Format the number into a TextData.
    numberastext=strfmt.FormatText(source = numfmt.FormatNumeric(source =
    number));
    You may have tried this already, but I hope it helps.
    Regards
    Iain
    -----Original Message-----
    From: Amin, Kamran [mailto:kamran.aminframeworkinc.com]
    Sent: 18 February 2000 13:37
    To: 'Forte User'
    Subject: (forte-users) Formatting a number
    I like to format a number as follows:
    L###-#### - Where a number like 23456 would format to L002-3456.
    Is there any way to do this in Forte using the NumericFormat object.
    thanks in advance.
    ka
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

    Thank you. That worked out great.
    ka
    -----Original Message-----
    From: Thompson Ian [mailto:Ian.Thompsonicl.com]
    Sent: Friday, February 18, 2000 9:35 AM
    To: 'Amin, Kamran'; 'Forte User'
    Subject: RE: (forte-users) Formatting a number
    Ka,
    Try using TextFormat in combination with NumericFormat - like this:
    strfmt : TextFormat = new;
    numfmt : NumericFormat = new;
    number : IntegerData = new;
    numberastext : TextData;
    numfmt.Template='L0000000';
    strfmt.Template='A###-####';
    number.SetValue(source = 23456);
    // Format the number into a TextData.
    numberastext=strfmt.FormatText(source = numfmt.FormatNumeric(source =
    number));
    You may have tried this already, but I hope it helps.
    Regards
    Iain
    -----Original Message-----
    From: Amin, Kamran [mailto:kamran.aminframeworkinc.com]
    Sent: 18 February 2000 13:37
    To: 'Forte User'
    Subject: (forte-users) Formatting a number
    I like to format a number as follows:
    L###-#### - Where a number like 23456 would format to L002-3456.
    Is there any way to do this in Forte using the NumericFormat object.
    thanks in advance.
    ka
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

  • What is this error java.sql.SQLException: Bad format for number ?

    Dear All,
    I am reading few values from database. Then I get this error "MyError:Error : java.sql.SQLException: Bad format for number 'Sarawak' in column 6. " So what is this error referring to. I have checked the database column and its value fits according the data type. Any hints please?

    I have checked the database column and its value fits according the data type.Check again. Then check again. Keep checking until you find your error. You are trying to read a string containing "Sarawak" as a number. You have "getInt(6)" or other numeric type, and the 6th column in the select statement is not numeric.

  • Format of Number in an Iview

    Hi All,
    I'm a newby in SAP PORTAL.
    We developp an iview that print number on a page.
    Yet, the number appears with the english format of number. Example : 1.578.858
    Yet, I would like to see the french format, without dot between number. Example : 1 578 858
    Does anone know where i can change the format for the number ?
    regards.

    Issac,
    There is no such settings in iView to change the number format.
    However, you can change the corresponding application in order to meet your requirement. If your iView backend is based SAP then this can be changed by changing the user profile of backend system. The tcode is SU01 and edit the user.
    You can use Number format or currentformat API if the application is based on Java .
    Ram

  • Formatting a number element with commas and decimals.

    I have a dataset with numbers.  I already set the column type to "number".
    I want to format the number data with commas and decimals.  I found a way to add decimals, but I'm still very confused how to do commas and to combine that with the decimal formatting.
    Also, how do I apply that to a repeat region in my spry region?
    Any help would be appreciated.  Thank you very much.

    I found this on one of the forum questions.
    Excel dont preserve the trailing zeros.
    try opening the xcel and type 5.0000 and tab out, it wont preserve the trailing zeros after decimal.
    try finding out how to disable the option in excel. if you do that, you will see what you send out from the report.
    But you can try to convert the number into a text by trying to append a space at the beginning. See if that would work.
    Thanks
    Swarna

  • Function to format a number to certain decimals?

    what is the function to format a number to certain decimals?

    Hi there
    There is no built in function as such, but the Math object
    provides the methods you need to build your own. Basically if you
    want 2 places you
    *multiply by 100
    *round it
    *divide by 100
    for 3 places you use 1000 etc. I include one of mine for you
    - hope it helps:
    var myNumber:Number=12.987654321;
    function
    roundThatNumber(theNumber:Number,thePlaces:Number):Number
    var theKey:Number=Math.pow(10,thePlaces);
    //trace(theKey);
    theNumber*=theKey;
    //trace(theNumber);
    theNumber=Math.round(theNumber);
    theNumber/=theKey
    return theNumber;
    trace(roundThatNumber(myNumber,2));
    trace(roundThatNumber(myNumber,3));
    trace(roundThatNumber(myNumber,4));

  • 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);
    }

  • 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

  • J2me :: format a number

    Hello.
    First I want you to know that I am very new to J2ME. In fact I have about 3 days since the first time I coded my first line.
    Well, I'm trying to write a midlet with Netbeans Mobility Pack that fetchs for a currency exchange value on Yahoo and displays it. Everything is ok until here.
    Then, the returned type that I get from Yahoo is a double and I want to format it as currency. So I tried importing java.text to use NumerFormat but the compiler throws an error saying package java.text does not exist.
    Isn't java.text included in WTK? Or is there a way that I can format a number like 123456.789 as 123,456.78 without using this package?
    Any ideas will be appreciated.
    Thanks in advance

    Isn't java.text included in WTK? No it's not included.
    Or is there a way
    that I can format a number like 123456.789 as
    123,456.78 without using this package?There is always a way! Just use some string maniplulation and put some comma's between your numbers.

  • Format a number with leading ones

    How do I format a number with leading ones or twos?
    This is what I'd do to format a number with 8 leading zeroes:
    String.format("%08d", 160)But, if I do the same with 8 leading ones, it does not work the way that I expect:
    String.format("%18d", 160)I'd appreciate your help.
    Thanks.

    933581 wrote:
    >
    What are you expecting?
    >
    I expected that "%18d" would pad with 1s.You assumed
    mmm I just thought that while "%08d" pads with 0s, the same would happen if I used "%18d" to pad with 1s.But if you would have looked at the javadoc of that method you would have very quickly known this was not the case and you wouldn't even had to create this thread. Why operate on guesswork when it is so easy to know reality? :(

  • Format a number, pad with spaces

    I want a simple way to format a number into a String, but have it padded with spaces. My code started like this:
    DecimalFormat myFormatter = new DecimalFormat("###.00");
    String output = myFormatter.format(12.5);
    The output is '12.50' when I want ' 12.50' (leading space). There's got to be an easy way to do this!
    Thanks for your help

    What you probably wanted to do was print some numbers in a column (of JTextArea's, for example) so that the decimal points line up.
    I wasted some more time and came up with the following:  String formattedNumber = numberPad(number, "###.00E0");
      static String numberPad(double number, String format) {
        int desiredDecimalPosition = format.indexOf('.');
        DecimalFormat numFormat = new DecimalFormat(format);
        String formattedNum = numFormat.format(Math.abs(number));
        formattedNum = formattedNum.replace('E', 'e');
        int exponentPosition = formattedNum.indexOf('e');
        if (exponentPosition < 0)
          exponentPosition = formattedNum.length();
        formattedNum = formattedNum.replaceFirst("e0", "");
        int decimalPosition = formattedNum.indexOf('.');
        formattedNum = (number > 0 ? " " : "-") + formattedNum;;
        if (decimalPosition < 0)
          decimalPosition = exponentPosition;
        int padding = desiredDecimalPosition - decimalPosition;
        if (padding > 0)
          formattedNum = "        ".substring(8 - padding) + formattedNum;
        return formattedNum;
      }Now it turns out that- despite the fact that I've told DecimalFormat to format precisely 2 digits to the right of the decimal, it sometimes randomly gives me 3, and (less often) 1!
    All this trouble just to try save 16kB of Henrik Bengtsson's sprintf in my jar file...

Maybe you are looking for

  • How do I find out what the video card on my MacBook Pro is?

    I am not sure where to look for this information and am trying to sell my computer. Any help would be appreciated.

  • How to find out the InfoObjects in Revised status

    I tried to install Technical content and many of my InfoObjects seems to have rolled to Revised Status. Is there a simple way to find out which are the InfoObjects which have been revised? I guess I need to write a query or so. However not sure where

  • TS1424 Playing movie on computer

    I bought the movie Hotel for Dogs,and i can only watch this on itunes,when i try and watch on the computer it comes up with a music note,also can't seem to burn on a disc or move it to a usb.

  • Can't see folder in Dreamweaver

    Hi, I've got a site that was developed in Dreamweaver using templates.  Those pages based off the templates are edited by users using Contribute.  Things have been going smoothly for months.  They are still working, however a sub-folder in the site d

  • Updater not updating

    Hello My updating is not working, either through Version Cue (4.0.1) or though the Help>Updates... menu.  I do have all the applications selected in Adobe Updater Preferences, but none of the applications themselves are updating.  They are all stuck