Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1007682 // formatXYZ_varToIndex - returns index counting from 1 (or 0 if no variable)

JavaX fragment (include)

1  
static int formatXYZ_varToIndex(S t) {
2  
  if (l(t) == 1 && eqOneOf(t, "X", "Y", "Z"))
3  
    ret 1 + charDiff(t.charAt(0), 'X');
4  
  else if (l(t) == 2 && t.startsWith("A")) {
5  
    char c = t.charAt(1);
6  
    if (c >= 'A' && c <= 'Z')
7  
      ret 4 + charDiff(t.charAt(1), 'A');
8  
  }
9  
  ret 0;
10  
}

Author comment

Began life as a copy of #1007412

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007682
Snippet name: formatXYZ_varToIndex - returns index counting from 1 (or 0 if no variable)
Eternal ID of this version: #1007682/3
Text MD5: 7d8cdc12b6051d4cd4985eeb8e6313fa
Author: stefan
Category: javax / formatting
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-02 12:47:08
Source code size: 291 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 652 / 617
Version history: 2 change(s)
Referenced in: [show references]