B4A Library [B4X] B4XFormatter - Advanced number formatter - Erel    May 21, 2023   (38 reactions) B4XFormatter is an alternative to NumberFormat / NumberFormat2 keywords. It is implemented in B4X and it is cross platform. There are two types in the library: B4XFormatter - The main class. B4XFormatData - A type with various configurable fields. The formatter holds a list of format data objects B4A Question How use comparation <= operator in float? - Erel (first post)    Apr 27, 2023   (1 reaction) This is quite hacky. NumberFormat returns a string which is them implicitly parsed to a number. The only reason that it works is that the implicit parsing returns a double which is the same type of the right hand side. I wouldn't consider it safe code.
The correct way to compare two floating point Bug? NumberFormat & NumberFormat2 not formating decimals - klaus (first post)    Nov 03, 2015   (2 reactions) What exactly do you expect ?
NumberFormat(Number As Double, MinimumIntegers As Int, MaximumFractions As Int)
returns 2 fractions max but removes any non significant zeros.
If you want at least one fraction you should use NumberFormat2:
NumberFormat2(Number As Double, MinimumIntegers As Int, MaximumF Bug? NUMBERFORMAT error - klaus (first post)    Sep 03, 2020   (4 reactions) It is correct.
NumberFormat converts a Double into a String with "," as the thousand separator by default.
To get the result you expect you should use:
NumberFormat2(150, 5, 0, 0, False) Bug? NumberFormat(Number,0,2): Works on Android but doesn't work in B4J - LWGShane    Feb 22, 2020   (1 reaction) If you use NumberFormat(1000000,0,2) on Android it correctly displays as "1,000,000" but displays as "1000000" on B4J.
B4J:
89007
B4A:
89006 B4J Question Very strange problem adding two numbers - MegatenFreak (first post)    Apr 07, 2021   (1 reaction) I use NumberFormat (and NumberFormat2) a lot. It's a life saver!
I was just wondering if there's a particular reason, something evil or mysterious about number 3, or if I was doing something wrong.
Fortunately, thanks to Erel, NumberFormat also "rounds" the number to the specified number of fraction B4A Question Rounding of numbers for currencies - Erel (first post)    Jan 03, 2017   (1 reaction) In the code you posted in the first post there is no difference between the two methods.
NumberFormat is the preferred method. It encourages you to keep the most accurate value (stored in the Double variable) and only round the number when you display it to the user.
Note that you can also use the B4J Question [BANano]NumberFormat2 gives a different behavior in BANano than in B4J - alwaysbusy (first post)    Sep 20, 2021   (1 reaction) Although the behaviour is indeed different, I honestly find what B4J (Java) produces confusing. If I ask for a minimum of two fractions, I would expect 0,00 not 0
I see quite some posts with questions on how numberformat works and what people expect as result. B4A Tutorial Read / Write Excel files on Android - OliverA (first post)    Aug 19, 2017   (1 reaction) NumberFormat is a B4X function, not an Excel function. So in this case, NumberFormat would execute before Summe.InitializeFormula places the cell contents into the Excel workbook and before Excel does any calculations. I don't think this is what you were trying to accomplish. This is before we get t B4A Question NumberFormat, is this an bug? - Daestrum (first post)    Sep 21, 2024   (1 reaction) Are you referring to the comma in the first numberformat?
The comma is a thousands separator in some locales (UK for example) but I understand some use comma as the decimal point so it could look wrong. Page: 1   2   3   4   5   6   7   Powered by ColBERT |