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

13
LINES

< > BotCompany Repo | #1035109 // parseHexRange

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7688L/43K).

1  
static IntRange parseHexRange(S s) {
2  
  LS parts = splitAtMinus(s);
3  
  int start = hexToInt(first(parts));
4  
  if (empty(parts))
5  
    null;
6  
  else if (l(parts) == 1)
7  
    ret intRange_incl(start, start);
8  
  else if (l(parts) == 2) {
9  
    int end = hexToInt(second(parts));
10  
    ret intRange_incl(start, end);
11  
  } else
12  
    fail("Too many minuses");
13  
}

Author comment

Began life as a copy of #1035095

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035109
Snippet name: parseHexRange
Eternal ID of this version: #1035109/1
Text MD5: 4355f3507c79b9b5cd773e053891d8e0
Transpilation MD5: 151f96520c82c63237f377f8e8bb6409
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-30 03:36:15
Source code size: 352 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 68 / 94
Referenced in: [show references]