// We dropped the "***" support here (use match3 for that) static S[] find2(L<S> pat, L<S> tok) { for (int idx = 0; idx < tok.size(); idx += 2) { // TODO: subtract pat size from end index S[] result = find2(pat, tok, idx); if (result != null) return result; } return null; } static S[] find2(L<S> pat, L<S> tok, int idx) { if (idx+pat.size() > tok.size()) return null; new L<S> result; for (int i = 1; i < pat.size(); i += 2) { S p = pat.get(i), t = tok.get(idx+i); if (eq(p, "*")) result.add(t); else if (!p.equalsIgnoreCase(t)) return null; } return toStringArray(result); }
Began life as a copy of #1000812
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001234 |
| Snippet name: | find2 function |
| Eternal ID of this version: | #1001234/2 |
| Text MD5: | 0d8d8b14ab11ac47da5b83c18a65aeca |
| Author: | stefan |
| Category: | |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-11-13 13:47:29 |
| Source code size: | 654 bytes / 23 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1121 / 2830 |
| Version history: | 1 change(s) |
| Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1014421 - find2plusIndex - returns C index #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |