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

11
LINES

< > BotCompany Repo | #1030630 // defaultExtension

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

Libraryless. Click here for Pure Java version (2854L/17K).

static File mapMethodLike defaultExtension(S ext, File file) {
  if (empty(ext)) ret file;
  if (file == null || fileHasAnyExtensionAtAll(file)) ret file;
  ret appendToFileName(addDotPrefix(ext), file);
}

sS defaultExtension(S ext, S fileName) {
  if (empty(ext)) ret fileName;
  if (fileName == null || contains(fileName, '.')) ret fileName;
  ret rjoin(addDotPrefix(ext), fileName);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030630
Snippet name: defaultExtension
Eternal ID of this version: #1030630/7
Text MD5: 84eb0434f22ceade08a20c120ff2bb3e
Transpilation MD5: 5c4f90be2f90c118a8df1df29eb7aad9
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-02-09 10:27:00
Source code size: 398 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 198 / 280
Version history: 6 change(s)
Referenced in: [show references]