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

9
LINES

< > BotCompany Repo | #1015296 // appendToTextFile_uniq

JavaX fragment (include)

please include function appendToFile.

static void appendToTextFile_uniq(File f, S s) {
  if (empty(s)) ret;
  lock appendToFile_lock;
  S text = loadTextFile(f);
  if (!contains(lines(text), s))
    appendToFile(f, (empty(text) || endsWithNewLine(text) ? "" : "\n") + assureTrailingNewLineIfNempty(s));
}
  

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1015296
Snippet name: appendToTextFile_uniq
Eternal ID of this version: #1015296/2
Text MD5: eb66b43ed7ce334b5fc58096c0e5ba52
Author: stefan
Category: javax / io
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-11 14:20:22
Source code size: 317 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 322
Version history: 1 change(s)
Referenced in: [show references]