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.

// returns minute ranges from 0 to 24*60
static L<IntRange> parseBusinessHours(S s) {
  LS parts = nempties(tok_splitAtComma(s));
  ret map(parts, part -> {
    LS l = splitAtMinus(part);
    IntRange r = intRange(
      parseHourAndOptionalMinutesToMinutes(first(l)),
      parseHourAndOptionalMinutesToMinutes(second(l)));
    if (r.end < r.start && r.start <= 12*60 && r.end < 12*60)
      r.end += 12*60;
    ret r;
  });
}

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: 229 / 328
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1028629 - parseBusinessHours_pcall
#1030447 - splitBusinessHoursAtMidnight