[Development] Introducing discussion about QStringFormatter

Mårten Nordheim marten.nordheim at qt.io
Thu May 18 11:57:43 CEST 2017


On 16.05.2017 19:14, Thiago Macieira wrote:
> On {}{}: I think that's an acceptable shorthand, just like we have "%1 is %1"
> today. A bracket without any digits has higher replacement precedence than
> {0}:
>
>    "The {0} brown {} jumped over the {2} {3}" % ("fox", "quick", "dog", "lazy")
>
> {} gets replaced ahead of {0}, then {0}, then {2} because {1} is missing, then
> {3}.
Hm, interesting approach to it, other approaches I've seen is:
- {} gets assigned the first unused number (in your example it'd be 
equivalent to {1})
- No mixing between numbered and unnumbered placeholders

But to clarify, in your scenario
     "{}{}" % ("a", "b")
would be "ab", correct?
--
Mårten Nordheim



More information about the Development mailing list