[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-04-23 (10:56) |
From: | Christian Sternagel <christian.sternagel@u...> |
Subject: | Format.printf |
Is there a possibility to parametrize format-strings. E.g. I want to provide a function [print_string], that, given an integer [i], right-aligns a string as if it was of length [i]. But following code is obviously not possible: let print_string i s = Format.printf "%%is\n" i s;; Since "%%" is a `normal' %. But since I do not know the needed length in advance I can not write something like let print_string i s = Format.printf "%10s\n" s;; Any suggestions? cheers christian