---

title: Nix string padding

date: 2018-07-13

layout: post

lang: en

eu_categories: nix

ref: nix-string-padding

---

```nix
padString = (n: if n < 10 then "0" + toString n else toString n)
```
