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

10
LINES

< > BotCompany Repo | #1025717 // angleBracketVarsToStars

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

Libraryless. Click here for Pure Java version (3051L/18K).

1  
// e.g. "I am <vague height>" to "I am *"
2  
// var names will be stripped of angle brackets
3  
sS angleBracketVarsToStars(S s, LS varNames_out default null) {
4  
  LS tok = javaTokWithAngleBrackets(s);
5  
  for (int idx : indicesOfAngleBracketVars(tok)) {
6  
    varNames_out?.add(deAngleBracket(tok.get(idx)));
7  
    tok.set(idx, "*");
8  
  }
9  
  ret join(tok);
10  
}

Author comment

Began life as a copy of #1024416

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: #1025717
Snippet name: angleBracketVarsToStars
Eternal ID of this version: #1025717/3
Text MD5: be50066dc1f62e7c94ed218a51bf8e0b
Transpilation MD5: 06ae184ce4a7c7fcbcee00f6f76adf13
Author: stefan
Category: javax / tokenizing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-03-18 16:33:17
Source code size: 352 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 211 / 295
Version history: 2 change(s)
Referenced in: [show references]