Quantcast
Channel: How can I pad an integer with zeros on the left? - Stack Overflow
Viewing all articles
Browse latest Browse all 23

Answer by Dr Adams for How can I pad an integer with zeros on the left?

$
0
0

Use this simple Kotlin Extension function

fun Int.padWithZeros(): String {   return this.toString().padStart(4, '0')}

Viewing all articles
Browse latest Browse all 23

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>