robin
03/16/2017, 12:54 PMd.toString().trim('0')
would be one waymg6maciej
03/16/2017, 12:55 PMpawegio
03/16/2017, 12:57 PMtrimEnd()
will do the jobrobin
03/16/2017, 12:57 PMDouble.toString()
doesn't contain any leading zeroes by default. Of course if you're also formatting and want leading zeros that's another thing.mg6maciej
03/16/2017, 12:58 PM0.123
mg6maciej
03/16/2017, 1:03 PMtrimEnd('0')
is not enough if you have "1.000"
.robin
03/16/2017, 1:03 PMpawegio
03/16/2017, 1:07 PMβ1.0β.trimEnd(β0β)
returns 1.
πleaudro
03/16/2017, 1:16 PM1000
into "1"
? This trimEnd
technique would do that.. would that be expected?pawegio
03/16/2017, 1:21 PMif (d == Math.floor(d)) "%.0f".format(d) else d.toString()
leaudro
03/16/2017, 1:22 PMtrimEnd
should work