Browse thread
printf and positional specifier
[
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: | Martin Jambon <martin1977@l...> |
| Subject: | Re: [Caml-list] printf and positional specifier |
On Sat, 11 Nov 2006, Peter Gregory wrote: > Anastasia Gornostaeva wrote: >> Hello. >> >> $ ocaml >> Objective Caml version 3.09.3 >> >> # open Printf;; >> # printf "%2$d %1$s" "abc" 2;; >> Bad conversion %$, at char number 0 in format string ``%2$d %1$s'' >> >> >> How? >> >> ermine >> > > Hi Ermine, > > I'm not sure that I understand your question. I think to achieve what you > seem to be trying, you would simply write: > > # printf "%d %s" 2 "abc";; > > You just put the parameters in the order they came in the string. Does that > help, it seems like perhaps you needed more than that. The dollar stuff is real, although I have no idea of how to make it work. It's the last paragraph in the description of Printf.fprintf: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html Martin -- Martin Jambon, PhD http://martin.jambon.free.fr