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

13
LINES

< > BotCompany Repo | #1028626 // parseBusinessHours

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

Transpiled version (3013L) is out of date.

1  
// returns minute ranges from 0 to 24*60
2  
static L<IntRange> parseBusinessHours(S s) {
3  
  LS parts = nempties(tok_splitAtComma(s));
4  
  ret map(parts, part -> {
5  
    LS l = splitAtMinus(part);
6  
    IntRange r = intRange(
7  
      parseHourAndOptionalMinutesToMinutes(first(l)),
8  
      parseHourAndOptionalMinutesToMinutes(second(l)));
9  
    if (r.end < r.start && r.start <= 12*60 && r.end < 12*60)
10  
      r.end += 12*60;
11  
    ret r;
12  
  });
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028626
Snippet name: parseBusinessHours
Eternal ID of this version: #1028626/4
Text MD5: b15dadee9c3bf9d0e98fc2b6a58d21b5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-17 20:35:00
Source code size: 439 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 228 / 328
Version history: 3 change(s)
Referenced in: [show references]