Re: string function - "format" function proposal
Itagaki Takahiro <itagaki.takahiro@gmail.com>
From: Itagaki Takahiro <itagaki.takahiro@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@commandprompt.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2010-10-14T06:25:49Z
Lists: pgsql-hackers
> Let's make format support %s, %i, and %l, as well as
> allowing things like %$3l (meaning, escape the third argument as a
> literal and interpolate here), and call it good.
Your idea is:
% [ $ pos ] format -- ex. %$3l , %l
Escapes: %% => %
Just for information, $ and pos are reversed in C sprintf.
% [ pos $ ] format -- ex. %3$l , %l
Escapes: %% => %
IMHO, I like {} syntax as like as C# because the format strings are extensible.
{ pos [ : format ] } -- ex {3:l}, {3} (, and {l} could be also supported)
Escapes: {{ => {, }} => }
--
Itagaki Takahiro