Libraryless. Click here for Pure Java version (2623L/17K).
static CharacterClassIterator stringToCharacterClassIterator(S s) { ret new stringToCharacterClassIterator_C(s); } sclass stringToCharacterClassIterator_C extends CharacterClassIterator { S s; int i, l; *() {} *(S *s) { l = l(s); } *(S *s, int *i, int *l) {} // no check because of method contract CharacterClassIterator acceptChar(char c) { ++i; this; } bool canEndHere() { ret i >= l; } bool canAcceptChar(char c) { ret i < l && s.charAt(i) == c; } CharRange acceptedCharRange() { ret i >= l ? null : singletonCharRange(s.charAt(i)); } CharacterClassIterator cloneCCI() { ret new stringToCharacterClassIterator_C(s, i, l); } }
Began life as a copy of #1029554
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: | #1029557 |
Snippet name: | stringToCharacterClassIterator |
Eternal ID of this version: | #1029557/8 |
Text MD5: | acec490051793484b3f29d937a06a472 |
Transpilation MD5: | 41fb162231cac70d453fc703843072a8 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-08-23 12:19:36 |
Source code size: | 740 bytes / 34 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 261 / 346 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1029558 - CCI_Substring - CharacterClassIterator accepting a substring, then forwarding to a follow-up iterator #1029559 - characterClassIteratorFromMiniRegexp_v1 - only supports optional characters ("ab?c", dev.) |