[
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: | -- (:) |
| 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 ... Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - 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. http://www.annexia.org/freeware/makeplus/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners