View Problem

Left Space pad a number

Given the number 73 left pad it to 10 characters "        73"
DiskEdit
ruby
73.to_s.rjust(10)
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ formatted = Convert::ToString(73)->PadLeft(10);
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ formatted = String::Format("{0,10:D}", 73);
ExpandDiskEdit
cpp
std::printf("%10d\n", 73);
ExpandDiskEdit
cpp
std::ostringstream os;
os << std::setw(10) << std::setfill(' ') << 73 << std::ends;
std::cout << os.str() << std::endl;
ExpandDiskEdit
cpp
std::cout << boost::format("%|10|") % 73 << std::endl;
ExpandDiskEdit
fsharp
let formatted = sprintf "%10d" 73
printfn "%s" formatted
ExpandDiskEdit
fsharp
let formatted = String.Format("{0,10:D}", 73)
Console.WriteLine(formatted)
ExpandDiskEdit
fsharp
let formatted = Convert.ToString(73).PadLeft(10)
Console.WriteLine(formatted)
DiskEdit
clojure
(let [s (str 73)
l (count s)]
(str (reduce str (repeat (- 10 l) " ")) s ))
ExpandDiskEdit
erlang
Formatted = io_lib:format("~10B", [73]),
ExpandDiskEdit
erlang
io:format("~10B~n", [73]).

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