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

9
LINES

< > BotCompany Repo | #1029381 // handleHashtags

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

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

sS handleHashtags(S text, IF1<S> handler) {
  LS tok = regexpICMatchesAsCNC(regexpNegativeLookbehind("\\w") + "#\\w+\\b", text);
  if (l(tok) == 1) ret text; // no hashtags found
  
  for (int i = 1; i < l(tok); i += 2)
    tok.set(i, unnull(handler.get(tok.get(i))));

  ret join(tok);
}

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: #1029381
Snippet name: handleHashtags
Eternal ID of this version: #1029381/1
Text MD5: 3897c48a441c51639e5977bfb629b563
Transpilation MD5: 33edc141394e9736f4265ef7e1bbae9b
Author: stefan
Category: javax / chat bots
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-03 14:28:45
Source code size: 298 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 125 / 192
Referenced in: [show references]