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

17
LINES

< > BotCompany Repo | #1028781 // matchStringListWithStringIC

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

Libraryless. Click here for Pure Java version (2521L/16K).

// returns (number of list elements matched, index in element, index in string)
static T3<Int> matchStringListWithStringIC(LS list, S string) {
  int iList = 0, iElement = 0, iString = 0;
  S element = first(list);
  while (element != null && iString < l(string)) {
    if (iElement >= l(element)) {
      element = get(list, ++iList);
      iElement = 0;
    } else if (!eqic(string.charAt(iString), element.charAt(iElement)))
      break;
    else {
      ++iElement;
      ++iString;
    }
  }
  ret t3(iList, iElement, iString);
}

Author comment

Began life as a copy of #1028778

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: #1028781
Snippet name: matchStringListWithStringIC
Eternal ID of this version: #1028781/5
Text MD5: 9a3ef82506022fd8893c3d5edcc71549
Transpilation MD5: d9cff36af23f6bd5b64581aa98d577d7
Author: stefan
Category: javax / linecomp
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-08 21:28:42
Source code size: 550 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 130 / 201
Version history: 4 change(s)
Referenced in: [show references]