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

16
LINES

< > BotCompany Repo | #1013805 // replaceExtension

JavaX fragment (include)

1  
static File replaceExtension(File f, S extOld, S extNew) {
2  
  ret newFile(replaceExtension(f2s(f), extOld, extNew));
3  
}
4  
5  
static File replaceExtension(File f, S extNew) {
6  
  ret replaceExtension(f, fileExtension(f), extNew);
7  
}
8  
9  
static S replaceExtension(S s, S extOld, S extNew) {
10  
  s = dropSuffixIC(addPrefixOptIfNempty(".", extOld), s);
11  
  ret s + addPrefixOptIfNempty(".", extNew);
12  
}
13  
14  
static S replaceExtension(S name, S extNew) {
15  
  ret replaceExtension(name, fileExtension(name), extNew);
16  
}

Author comment

Began life as a copy of #1011103

download  show line numbers  debug dex  old transpilations   

Travelled to 19 computer(s): aoiabmzegqzx, ayivmpnvhhik, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1013805
Snippet name: replaceExtension
Eternal ID of this version: #1013805/10
Text MD5: acf1b36c10f22f545cb095182f841fc9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-27 22:04:59
Source code size: 504 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 525 / 1575
Version history: 9 change(s)
Referenced in: [show references]