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

16
LINES

< > BotCompany Repo | #1013805 // replaceExtension

JavaX fragment (include)

static File replaceExtension(File f, S extOld, S extNew) {
  ret newFile(replaceExtension(f2s(f), extOld, extNew));
}

static File replaceExtension(File f, S extNew) {
  ret replaceExtension(f, fileExtension(f), extNew);
}

static S replaceExtension(S s, S extOld, S extNew) {
  s = dropSuffixIC(addPrefixOptIfNempty(".", extOld), s);
  ret s + addPrefixOptIfNempty(".", extNew);
}

static S replaceExtension(S name, S extNew) {
  ret replaceExtension(name, fileExtension(name), extNew);
}

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: 526 / 1575
Version history: 9 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1015293 - changeExtension