View Problem

Right Space pad a number

Given the number 1024 right pad it to 6 characters "1024  "
DiskEdit
ruby
1024.to_s.ljust(6)
DiskEdit
csharp
public class NumberRightPadding {
public static void Main() {
string withStringDotFormat = string.Format("{0,-6}", 1024);
string withToStringDotPadRight = 1024.ToString().PadRight(6);
}
}
ExpandDiskEdit
fantom
formatted := 1024.toStr.padr(6)
DiskEdit
clojure
(let [s (str 1024)
l (count s)]
(str s (reduce str (repeat (- 6 l) " "))))

Submit a new solution for ruby, csharp, fantom, or clojure
There are 28 other solutions in additional languages (cpp, erlang, fsharp, go ...)