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).

1  
// returns (number of list elements matched, index in element, index in string)
2  
static T3<Int> matchStringListWithStringIC(LS list, S string) {
3  
  int iList = 0, iElement = 0, iString = 0;
4  
  S element = first(list);
5  
  while (element != null && iString < l(string)) {
6  
    if (iElement >= l(element)) {
7  
      element = get(list, ++iList);
8  
      iElement = 0;
9  
    } else if (!eqic(string.charAt(iString), element.charAt(iElement)))
10  
      break;
11  
    else {
12  
      ++iElement;
13  
      ++iString;
14  
    }
15  
  }
16  
  ret t3(iList, iElement, iString);
17  
}

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: 223 / 321
Version history: 4 change(s)
Referenced in: [show references]