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

14
LINES

< > BotCompany Repo | #1026755 // fixFunctionIncludeSnippetName

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

Libraryless. Click here for Pure Java version (8733L/50K).

1  
static Offer fixFunctionIncludeSnippetName(S snippetID) {
2  
  if (!isJavaXIncludeSnippet(snippetID)) null;
3  
  S text = loadSnippet(snippetID);
4  
  S fname = first(findFunctionDefsAtCurlyLevel(0, text));
5  
  if (empty(fname)) null;
6  
  S title = snippetTitle(snippetID);
7  
  LS tok = javaTok(title);
8  
  if (neq(firstToken(tok), fname)) {
9  
    tok.set(1, fname);
10  
    ret Offer("Rename snippet " + snippetID + " to: " + join(tok),
11  
      r { renameSnippet(snippetID, join(tok)) });
12  
  }
13  
  null;
14  
}

Author comment

Began life as a copy of #1026389

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: #1026755
Snippet name: fixFunctionIncludeSnippetName
Eternal ID of this version: #1026755/4
Text MD5: 0e1ca33b5724ed0c964834a64a96d9e1
Transpilation MD5: d93bc7adcacc73ef0ebd1e034d64643c
Author: stefan
Category: javax / snippets
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-10 00:20:31
Source code size: 491 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 134 / 235
Version history: 3 change(s)
Referenced in: [show references]