Re: [WebDNA] Formatting numbers - truncation instead of rounding
This WebDNA talk-list message is from 2011
It keeps the original formatting.
numero = 107467
interpreted = N
texte = Not sure what is the best/most elegant/shortest way.. but off the top of =my head, quickly without thinking:[ListWords Words=3D178.9964&Delimiters=3D.][if =("[index]"=3D"1")][then][word][/then][else].[getchars =start=3D1&end=3D2][word][/getchars][/else][/if][/ListWords]-G> Hi>=20> Can anyone tell me the best way to truncate a number using [format] =rather than having it round up/down.>=20> Eg. I have 178.9964 as a value, and I need 178.99 as the outcome>=20> Obviously using [format .2f][value][/format] will round this to =179.00, so I need another method.>=20>=20> Thanks all,>=20>
>=20
Associated Messages, from the most recent to the oldest:
Not sure what is the best/most elegant/shortest way.. but off the top of =my head, quickly without thinking:[ListWords Words=3D178.9964&Delimiters=3D.][if =("[index]"=3D"1")][then][word][/then][else].[getchars =start=3D1&end=3D2][word][/getchars][/else][/if][/ListWords]-G> Hi>=20> Can anyone tell me the best way to truncate a number using [format] =rather than having it round up/down.>=20> Eg. I have 178.9964 as a value, and I need 178.99 as the outcome>=20> Obviously using [format .2f][value][/format] will round this to =179.00, so I need another method.>=20>=20> Thanks all,>=20> >=20
Govinda
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
More on the email templates (1997)
Linux ODBC and the ODBC Bridge (2000)
LineItem variable set (2007)
.. more on sliding discounts... (1997)
writefile and deletefile (1998)
$purchase WITHOUT creditcar (1997)
Windows version Trouble Shooting (2007)
Mac: LModelDirector bug fix (1997)
credit card question (simple) (2001)
View Source from cache (1997)
hideif [x]=1,2,3.. (2003)
Is there a way to just get to the last record in the database? (1997)
convert date and time (2005)
Bug alert! (1997)
WC2.0 Memory Requirements (1997)
randomness (1997)
Webcat no longer supported? (2006)
WebDNA on Intel Mac (2006)
AuthorizeNet SSL Update (2004)
Permissions (2000)