1 | // if text trails with \n, drops the line before that |
2 | static S dropLastLine(S s) {
|
3 | s = dropSuffix("\r", dropSuffix("\n", s));
|
4 | int i = s.lastIndexOf('\n');
|
5 | ret i < 0 ? "" : dropSuffix("\r", substring(s, 0, i));
|
6 | } |
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: | 876 / 882 |
| Referenced in: | [show references] |