// if text trails with \n, drops the line before that static S dropLastLine(S s) { s = dropSuffix("\r", dropSuffix("\n", s)); int i = s.lastIndexOf('\n'); ret i < 0 ? "" : dropSuffix("\r", substring(s, 0, i)); }
Began life as a copy of #1001797
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005181 |
Snippet name: | dropLastLine |
Eternal ID of this version: | #1005181/1 |
Text MD5: | 8742586e1633587c836afcfb481c35b1 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-19 15:16:39 |
Source code size: | 222 bytes / 6 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 633 / 630 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1023681 - dropLastTwoLines - not very efficient |