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

8
LINES

< > BotCompany Repo | #1015734 // humanizeFormLabel - e.g. "snippetID" -> "Snippet ID"

JavaX fragment (include)

1  
static Map<S> humanizeFormLabel_replacements = litmap("id" := "ID", "md5" := "MD5");
2  
3  
sS humanizeFormLabel(S s) {
4  
  if (!isIdentifier(s)) ret s;
5  
  ret firstToUpper(
6  
    joinWithSpace(replaceElementsUsingMap(splitCamelCase(s), humanizeFormLabel_replacements)).replace("I D", "ID")
7  
  );
8  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015734
Snippet name: humanizeFormLabel - e.g. "snippetID" -> "Snippet ID"
Eternal ID of this version: #1015734/7
Text MD5: de16eacb36086b9959fc1b6e52086e0e
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-13 19:19:16
Source code size: 293 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 435 / 531
Version history: 6 change(s)
Referenced in: [show references]