NumberFormat2 (Number As Double, MinimumIntegers As Int, MaximumFractions As Int, MinimumFractions As Int, GroupingUsed As Boolean) As String
Converts the specified number to a string.
The string will include at least Minimum Integers, at most Maximum Fractions digits and at least Minimum Fractions digits.
GroupingUsed - Determines whether to group every three integers.
Example:
Log(NumberFormat2(12345.67, 0, 3, 3, false)) '"12345.670"
B4A Question Rounding Numbers: Round2 or Numberformat2 - Roger Daley    
Nov 11, 2014   
(1 reaction) Round2 but use Numberformat2 for rounding numbers.
Most of us are taught that for digits below 5... given by Round2.
Numberformat2 gives the result 4.72 after a bit of research I found...
link: As Double
For i = 1 To n
x = Rnd(0,1000) /1000
y = Round2(x,2)
z = NumberFormat(x,1,2...
link: We both defer to the wisdom of Erel!...
link: is, the choice between using Round2 and Numberformat2 for rounding. NF rounds nn.n5 up approximately...
Bug? Numberformat2 decimal places - Andrew (Digitwell)    
Nov 3, 2020 As Double = 1000
private s as string = NumberFormat2(n,0,2,0,False)
log(s)
...
link: As Double = 1000
private s as string = NumberFormat2(n,0,2,0,False)
log(s)
iOS...
link: "","UTF8")&"="& NumberFormat2(n,0,0,0,False)
Else...
link: As B4XFormatter
f.Initialize
f.GetDefaultFormat.MaximumFractions = 2
f.GetDefaultFormat.MinimumFractions = 0...
Bug? NumberFormat2() changes NumberFormat() behaivior - Gustavo Retana    
Nov 13, 2017Just for causality I used both NumberFormat and NumberFormat2 in the same code and I noticed that when I change the Grouping parameter in NumberFormat2, NumberFormat starts behaving accordingly with the parameter in NumberFormat2. If I set the Grouping as False in NumberFormat2, NumberFormat... False :" & NumberFormat2(a,1,12,0,False))
Log("3) NF NoGrouping?:" &...
link: It is fixed for the next update....
B4A Question NumberFormat2() with decimalseparator accroding to locale? - fredo    
Apr 1, 2017According to the documentation NumberFormat2() returns a string with a decimal separator and grouping characters.
NumberFormat2(12345.67, 0, 3, 3, True) = 12,345.670
While localizing a large project I need to have the comma and dot according to the devices active locale, but NumberFormat2() delivers the same for countries US and DE.
In order to avoid NumberFormatExceptions (de_DE expects...
link: In order to avoid NumberFormatExceptions (de_DE expects "12.345,670") I could change...
B4i Question Clarification of NumberFormat2 - ciginfo    
Nov 1, 20151 °) Can you precise me if NumberFormat2 rounds to a string or to a number (int, double etc.)
2°) I don't understand what mean different elements in NumberFormat2, can you explain me...
link: .236589 > 3800
NyNumber = 3800.236589
NumberFormat2(MyNumber, 1, 0, 0, False)
1 > at least one...
link: ,236589... I want to display 3800, how can I do?
MyNumber = 3800,236589....
MyNumber = NumberFormat2...
link: From the help, NumberFormat2 returns a String.
- 0 -> MinimumIntegers
- 3 -> MaximumFractions...
Bug? Bug in NumberFormat2? - Computersmith64    
Sep 16, 2015 looks like this:
txtCost.Text = NumberFormat2(mRec.Get("cost"), 1, 2, 2, False)
(Don... line (the one that uses NumberFormat2) then it all works fine. Also, if I change the first...
link: that it's only a problem after a call to NumberFormat2. In code where I've never made...
link: The correct code is:
Log($"$2.0{iHour}:$2.0{iMinute}"$)
Your code doesn't put any...
link: the NumberFormat2 line & run it again. Tap the Test button as many times as you want & you'll...
B4A Question Why 2.405 doesn't round to 2.41 with NumberFormat2 or Round2? - aeric (first post)    
Dec 7, 2021   
(1 reaction)Post in thread 'Rounding decimal point number'
https://www.b4x.com/android/forum/threads/rounding-decimal-point-number.106739/post-668311...
link: I just did some more tests and it also fails with 8.405, 9.405 and from 256.405 to 327.405...
link: ) or with NumberFormat2(2.405, 1, 2, 2, False) the result is 2.40.
Thanks in advance for any help....
B4A Question NumberFormat2 not working quite as I expect - barx    
Apr 10, 2015
Dim NewShade As Double = NumberFormat2((txtShade.Text - 0.01), 0, 2, 2, False)
Log(NewShade)
txtShade.Text = NewShade
End If
End Sub
How comes 2 decimal places...I'm wanting to show a number in an Edittext as x.xx with 2 decimal point values shown all...
link: = (txtShade.Text - 0.01)
Log(NumberFormat2(NewShade, 0, 2, 2, False))
txtShade.Text...
Italian NUMBERFORMAT2 - LucaMs (first post)    
Sep 16, 2021   
(2 reactions)119199
Il secondo parametro è il numero minimo di interi che dovranno essere visualizzati.
NumberFormat2(variabile, 1, 2, 0, False)...
link: = NumberFormat2(variabile,0,2,0,False)...
link: -virgola-decimali-modo-italiano.132037/page-2#post-833163...
Bug? NumberFormat & NumberFormat2 not formating decimals - ggpanta    
Mar 29, 2014Dim fiat As double
fiat = 6368.4397
NumberFormat(fiat, 0, 2)
Expected:
textFiat = 6368.43
Actual... that its not expected to format the original var but the output of numberforma to a text obj...
link: Aha! Thanks Klaus!
I was unaware of numberformat2, don't know how I missed...
link: fraction you should use NumberFormat2:
NumberFormat2(Number As Double, MinimumIntegers As Int...
link: decimal values not=zero: " & NumberFormat(fiat, 0, 2))
fiat = 6368.0...
Page: 1  
2  
3  
4  
5  
6  
7