From: Christian Sternagel <christian.sternagel@uibk.ac.at>
To: caml-list@yquem.inria.fr
Subject: Format.printf
Date: Mon, 23 Apr 2007 12:56:52 +0200 [thread overview]
Message-ID: <20070423105652.GA3339@pc6197-c703.uibk.ac.at> (raw)
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
next reply other threads:[~2007-04-23 10:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-23 10:56 Christian Sternagel [this message]
2007-04-23 11:31 ` [Caml-list] Format.printf Paolo Donadeo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070423105652.GA3339@pc6197-c703.uibk.ac.at \
--to=christian.sternagel@uibk.ac.at \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox