caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Run-time evaluation of a Printf format string
@ 2008-08-28 13:37 Jan Kybic
  2008-08-28 14:10 ` [Caml-list] " David Teller
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jan Kybic @ 2008-08-28 13:37 UTC (permalink / raw)
  To: caml-list

Hello,
        I would need an equivalent of Printf.sprintf where the 
format string is not constant, it is read from the command line.
The motivation is to let the user specify a template for file names,
such as "img%03d.png". Can this be achieved in Ocaml? It seems not, as 
Pervasives.string_of_format only accepts constant strings.
Or is there some external library useful for this task? 

For the moment I have started to implement it myself for the limited
set of format specifications I will need but if there is some more
elegant solution I would be interested to hear about it.

Thanks,

Jan

-- 
-------------------------------------------------------------------------
Jan Kybic <kybic@fel.cvut.cz>                       tel. +420 2 2435 5721
http://cmp.felk.cvut.cz/~kybic                      ICQ 200569450
D


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-29  7:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-28 13:37 Run-time evaluation of a Printf format string Jan Kybic
2008-08-28 14:10 ` [Caml-list] " David Teller
2008-08-28 14:58 ` Edgar Friendly
2008-08-28 15:01 ` Dave Benjamin
2008-08-28 16:01 ` Stéphane Glondu
2008-08-29  7:34   ` Jan Kybic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).