View Full Version : Ext.String.format named arguments

20 May 2016, 4:27 AM
I have string like this

Ext.String.format('{0} {1} {2} - {3}', a,b,c,d);

and I want to remove first argument. To do this I need to rename all other arguments that are left

Ext.String.format('{0} {1} - {2}', b,c,d);

that's easy when code is short, but what if it's long and mixed? I can do search and then rename, but it still sucks.

I think there's a reason why printf/sprint functions (http://php.net/manual/en/function.sprintf.php) are using non-named arguments for this like %d
%X for this (how the hell I move to next character to clear styling without using "clear style" button? this editor really sucks. And after posting a message I now see that styles that were pasted weren't applied and newlines and some weird formatting was added instead. I will let your eyes bleed and will not edit this. I think decent editor/forum should solve this problem automatically, and better not even create such problem. If pasted styles are not applied - they shouldn't be posted and shown in the first place)

Why named arguments was introduced instead?

20 May 2016, 5:25 AM

That's been around for a long time. I imagine it met a need when it was developed and has been that way ever since. You could always implement your own to accommodate an alternate strategy.