Libraryless. Click here for Pure Java version (5020L/28K).
sS lambda0Like hijackPrint(Runnable r) { new StringBuilder buf; O old = interceptPrintInThisThread(new F1<S, Bool>() { public Bool get(S s) { buf.append(s); false; } }); try { r?.run(); ret str(buf); } finally { interceptPrintInThisThread(old); } }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1011313 |
Snippet name: | hijackPrint - hijack the print function for a function call, return printed contents; can be nested |
Eternal ID of this version: | #1011313/12 |
Text MD5: | f43d1a4939b31f3483eb75047c00c094 |
Transpilation MD5: | 5f28b273d7ac9b9feb4678f705b13793 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-10 06:38:10 |
Source code size: | 306 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 607 / 746 |
Version history: | 11 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1012290 - hijackPrint_tee - hijack the print function for a function call, return printed contents, also print normally #1022299 - hijackPrintWithStackTraces - get list of all prints as pair (text, strack trace) #1029105 - hijackPrintWithResult #1030202 - hijackPrintOr |