What do you want to save?
Add Code snippet
New code examples
-
Java 2021-08-29 10:18:02
formatting an integer in java
Default formatting: String.format("%d", 93); // prints 93 Specifying a width: String.format("|%20d|", 93); // prints: | 93| Left-justifying within the specified width: String.format("|%-20d|", 93); // ... Add solution -
Other 2021-08-27 15:43:02
how to format a number into hh:mm:ss in lua
function convert_to_time(tenths) local hh = (tenths // (60 * 60 * 10)) % 24 local mm = (tenths // (60 * 10)) % 60 local ss = (tenths // 10) % 60 local t = tenths % 10 return string.format("%02d:%02d:%02d.%01d", hh, mm, ss, t) end Add solution