ios - NSString stringWithFormat less parameters -
this question exact duplicate of:
we need format string, localisations won't output parameters. seems doesn't work output less parameters passed:
nsstring *string = [nsstring stringwithformat: @"%2$@", @"<1111>", @"<22222>"]; nslog(@"string = %@", string);
outputs
string = <1111>
although output second parameter. bug or feature?
according related industrial standard, ieee specification:
when numbered argument specifications used, specifying nth argument requires leading arguments, first (n-1)th, are specified in format string.
which means in other words, must use first %1$@
parameter in string formatter somewhere before address use second 1 – so, not bug @ all.
Comments
Post a Comment