sclass LastLineBuffer { int lineCount; S lastLine, currentLine = ""; void append(S s) { currentLine += s; int i; while ((i = currentLine.indexOf('\n')) >= 0) { // inefficient lastLine = dropTrailingBackslashR(substring(currentLine, 0, i)); currentLine = substring(currentLine, i+1); } } S lastCompleteLine() { ret lastLine; } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007086 |
Snippet name: | LastLineBuffer - holds last line of a text stream |
Eternal ID of this version: | #1007086/3 |
Text MD5: | 004aebaff0e6e5417d974712acb341b4 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-02 22:02:16 |
Source code size: | 392 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 554 / 1201 |
Version history: | 2 change(s) |
Referenced in: | [show references] |