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

12
LINES

< > BotCompany Repo | #1034736 // addFunctionNameToInclude

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

Libraryless. Click here for Pure Java version (8094L/47K).

sS addFunctionNameToInclude(S snippetID, S functionName) {
  LS tok = javaTokSnippet(snippetID);
  var pif = tok_nextPleaseIncludeFunctionsStatement(tok);
  if (pif == null) ret "PIF statement not found in snippet";
  
  if (pif.containsFunction(functionName)) ret functionName + " already included";
  
  int i = pif.iFirstIdentifier;
  tokPrepend(tok, i, functionName + or2(javaDropComments(tok.get(i+1)), " "));
  
  ret editSnippet(snippetID, join(tok));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034736
Snippet name: addFunctionNameToInclude
Eternal ID of this version: #1034736/3
Text MD5: 35230906ca69b0c1a12745784115472c
Transpilation MD5: a0669ef15eed61455938379294bfd6f9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-07 23:12:51
Source code size: 471 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 67 / 123
Version history: 2 change(s)
Referenced in: [show references]