Hi,
Is there a simple way to format a Float into an X decimal place Str? I'm thinking of something similar to Java's:
Float
Str
String.format("%.2f", floatValue)
Cheers.
You probably want to look at:
For the latter you'll also have to look at the following:
Between these you can emulate most of String.format.
String.format
λ ~ → fansh Fantom Shell v1.0.62 ('?' for help) fansh> 12345.6789f.toLocale("0.00") 12345.68 fansh> 12345.6789f.toLocale("0.00").padl(10,'0') 0012345.68
Awesome! I skipped over sys::Float#toLocale thinking it was just boring I18N stuff!
Login or Signup to reply.
SlimerDude Sat 3 Mar 2012
Hi,
Is there a simple way to format a
Float
into an X decimal placeStr
? I'm thinking of something similar to Java's:Cheers.
ttmrichter Sat 3 Mar 2012
You probably want to look at:
For the latter you'll also have to look at the following:
Between these you can emulate most of
String.format
.SlimerDude Sat 3 Mar 2012
Awesome! I skipped over sys::Float#toLocale thinking it was just boring I18N stuff!