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

8
LINES

< > BotCompany Repo | #1018723 // setOneLineFileInfoField - removes line if value == null

JavaX fragment (include)

svoid setOneLineFileInfoField(File f, S field, O value) {
  File infoFile = associatedInfosFile(f);
  LS lines = lines(loadTextFile(infoFile));
  S newLine = value == null ? null : field + ": " + str(value);
  S line = firstStartingWithIC(lines, field + ": ");
  if (eq(line, newLine)) ret;
  saveTextFile(infoFile, lines(replaceAddOrRemove(lines, line, newLine)));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018723
Snippet name: setOneLineFileInfoField - removes line if value == null
Eternal ID of this version: #1018723/7
Text MD5: b107a2956209ab805cea94b5bcbdc695
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-27 12:59:27
Source code size: 374 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 353 / 410
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018729 - getOneLineFileInfoField