Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Printf question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-09-26 (18:02)
From: Richard Jones <rich@a...>
Subject: [Caml-list] Printf question
I want to write a function which is a bit like Printf.printf, but
handles the %s placeholder differently. It needs to do SQL-style
escaping, eg:

	my_printf "The string: %s" "string with 'quotes'"

would return the string:

	The string: 'string with ''quotes'''

(hope I've got that right ...)

Anyway, it looks like this should be possible, and possibly even quite
simple, with a custom formatter.

Can anyone give me a clue about this? Is Printf.printf implemented in
pure OCaml, or does it require trickery in the compiler to work? The
code is scarily complex ...


Richard Jones.
Merjis Ltd. - all your business data are belong to you.
MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles,
RPMs, pkgs etc. Linux, BSD, Solaris.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: