Task

Express a number in decimal as a fixed-length string with leading zeros.



For example, the number   7.125   could be expressed as   00007.125.




object FormattedNumeric {
  val r = 7.125                                   //> r  : Double = 7.125
  println(f" ${-r}%9.3f");                        //>     -7,125
  println(f" $r%9.3f");                           //>      7,125
  println(f" $r%-9.3f");                          //>  7,125    
  println(f" ${-r}%09.3f");                       //>  -0007,125
  println(f" $r%09.3f");                          //>  00007,125
  println(f" $r%-9.3f");                          //>  7,125    
  println(f" $r%+09.3f");                         //>  +0007,125
}