Libraryless. Click here for Pure Java version (1871L/12K).
// returns pair(regexp, vars) static Pair<S, LS> dollarVarsToRegexp_generic(S replacement, S s) { new L<S> varNames_out; L<S> tok = javaTok(s); int j = 0; for (int i = 1; i < l(tok); i += 2) { S t = tok.get(i); if (isDollarVar(t)) { replaceTokens(tok, j, i, regexpQuote(joinSubList(tok, j, i))); listAdd(varNames_out, t); tok.set(i, replacement); j = i+1; } } replaceTokens(tok, j, l(tok), regexpQuote(joinSubList(tok, j))); ret pair(join(tok), varNames_out); }
Began life as a copy of #1024301
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024302 |
Snippet name: | dollarVarsToRegexp_generic |
Eternal ID of this version: | #1024302/3 |
Text MD5: | 4749f22a5d2deccec54e28e1891b9e21 |
Transpilation MD5: | 06bb8dbc03c9a0a803dc7383cecc5314 |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-30 22:59:32 |
Source code size: | 529 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 182 / 265 |
Version history: | 2 change(s) |
Referenced in: | [show references] |