Ticket #1237 (closed enhancement: fixed)

Opened 19 months ago

Last modified 19 months ago

String.prototype.format should accept arbitrary number of arguments

Reported by: FND Owned by: JeremyRuston
Priority: trivial Milestone: 2.6.1
Component: core Version:
Severity: trivial Keywords:
Cc:

Description

Rather - or in addition to - passing an array of substrings to the format method, it would be useful (less noisy) to be able to pass an arbitrary number of string arguments:

"%0 - %1: %2".format(["foo", "bar", "baz"]);

vs.

"%0 - %1: %2".format("foo", "bar", "baz");

Change History

Changed 19 months ago by FND

Jeremy has some reservations about overloading the existing argument (required for backwards compatibility):

[passing an array of non-strings - e.g. passing an array of arrays is] not explicitly invalid

it doesn't really [make sense] at the moment, because there's no format string that renders arrays, but there could be

a more modern approach wouldn't add methods to the String class

Changed 19 months ago by MartinBudden

  • status changed from new to closed
  • resolution set to fixed

Fixed in changeset:12289

Note: See TracTickets for help on using tickets.