Add String#format method(not an alias of String#%)
I think it'd be great if String included a method similar to
% that accepts variable number of arguments (like
sprintf). This is trivial to implement as you're certainly aware.
Here's one implementation suggestion:
This would make the new method behave both like
String#%. I think this minor improvement would definitely be in the spirit of making more programmers happy :-)
Updated by shyouhei (Shyouhei Urabe) over 3 years ago
bozhidar (Bozhidar Batsov) wrote:
naruse (Yui NARUSE) wrote:
Show concrete use case.
How about simply:
"Hello, %s %s!".format("Mr.", "Bond")
That's too simple. What we need is how the requested feature improves the situation. What's wrong with the status-quo? and how is that relaxed using