Paul King created GROOVY-11569:
----------------------------------
Summary: Create a sprintf shortcut for 1-arg usage
Key: GROOVY-11569
URL: https://issues.apache.org/jira/browse/GROOVY-11569
Project: Groovy
Issue Type: Improvement
Reporter: Paul King
Currently we support:
{code:groovy}
var x = 1/3
assert sprintf('%5.3f', x) == '0.333'
{code}
I propose we also support:
{code:groovy}
assert x.sprintf('%5.3f') == '0.333'
assert [x, x, x]*.sprintf('%5.3f') == ['0.333', '0.333', '0.333']
{code}
It is intended to be a shortcut only for format strings containing a single
format specifier.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)