Results 1 to 2 of 2

Thread: Ext.String.format named arguments

  1. #1
    Sencha User
    Join Date
    Mar 2016
    Posts
    99
    Answers
    5
    Vote Rating
    29
      1  

    Default Answered: Ext.String.format named arguments

    I have string like this

    Code:
    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

    Code:
    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 are using non-named arguments for this like %d
    ,
    %i
    ,
    %o
    ,
    %u
    ,
    %x
    ,
    %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?

  2. Hi--

    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.

    Thanks!
    Joel

  3. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446
    Vote Rating
    186
      0  

    Default

    Hi--

    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.

    Thanks!
    Joel

Similar Threads

  1. Replies: 1
    Last Post: 24 Apr 2015, 12:13 PM
  2. Using router with optional, named URL arguments
    By jweber in forum Sencha Touch 2.x: Examples and Showcases
    Replies: 6
    Last Post: 31 Dec 2012, 6:03 PM
  3. array of arguments vs named arguments
    By jimmifett in forum Ext.Direct
    Replies: 1
    Last Post: 22 Apr 2012, 10:01 PM
  4. Named Arguments
    By Gjslick in forum Ext.Direct
    Replies: 2
    Last Post: 19 Jan 2010, 1:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •