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)

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

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: 564 / 533
Version history: 2 change(s)
Referenced in: [show references]