swift - Print Double with two digits both before and after the decimal separator -


i'm trying print double format : 01.87 or 23.98.

i've found how print 2 digits after point don't found how print 2 digits before.

this code moment:

let str = nsstring(format: "%.2f", myvaluetoprint as! double) 

how can print double 00.00?

use this:

let str = nsstring(format: "%05.2f",  myvaluetoprint as! double) 

Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -