package main

import (
    "fmt"
)

func main() {
    a := 1
    fmt.Println(a)
    //前置补0
    fmt.Printf("%03d", a)
    fmt.Println("")
    fmt.Printf("%0*d", 3, a)
}
[ `run` | done: 1.581527ms ]
  1
  001
  001

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-07-30
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-03
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
  • 2021-12-29
  • 2021-10-17
  • 2021-11-22
相关资源
相似解决方案