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 Aishwarya for How can I pad an integer with zeros on the left?

$
0
0

In Kotlin, you can use format() function.

val minutes = 5val strMinutes = "%02d".format(minutes)

where, 2 is the total number of digits you want to display(including zero).

Output: 05


Viewing all articles
Browse latest Browse all 23

Trending Articles



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