Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Anastasia Gornostaeva <ermine@ermine.pp.ru>
To: Peter Gregory <Peter.Gregory@cis.strath.ac.uk>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] printf and positional specifier
Date: Sat, 11 Nov 2006 23:59:18 +0300	[thread overview]
Message-ID: <20061111205918.GA14565@ermine.home> (raw)
In-Reply-To: <4556342C.10109@cis.strath.ac.uk>

On Sat, Nov 11, 2006 at 08:35:56PM +0000, Peter Gregory wrote:

> ># printf "%2$d %1$s" "abc" 2;;
> >Bad conversion %$, at char number 0 in format string ``%2$d %1$s''

> 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.

>From documentation on Printf module:

   Conversion specifications have the following form:

   % [positional specifier] [flags] [width] [.precision] type

   The optional positional specifier consists of an integer followed by a $;
   the integer indicates which argument to use, the first argument being
   denoted by 1.

ermine


      parent reply	other threads:[~2006-11-11 20:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-11 20:12 Anastasia Gornostaeva
2006-11-11 20:35 ` [Caml-list] " Peter Gregory
2006-11-11 20:52   ` Martin Jambon
2006-11-11 21:15     ` Peter Gregory
2006-11-11 21:26       ` Martin Jambon
2006-11-11 21:40       ` Anastasia Gornostaeva
2006-11-12  0:46         ` Martin Jambon
2006-11-11 20:59   ` Anastasia Gornostaeva [this message]

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=20061111205918.GA14565@ermine.home \
    --to=ermine@ermine.pp.ru \
    --cc=Peter.Gregory@cis.strath.ac.uk \
    --cc=caml-list@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