ゼロ埋めする
JavaScript
String.prototype.padStart を使う
code:js
'9'.padStart(2, '0') // 09
Ruby
String#rjustを用いる
str.rjust(全体の文字数, 埋める文字)
code:rb
"123".rjust(4, "0") # 0123
Python
zfill
code:py
'123'.zfill(4) # 0123
rjust
code:py
'123'.rjust(4, '0') # 0123
code:py
i = 123
f'{i:04}' # 0123