1 | please include function shorten. |
2 | |
3 | static Symbol shortenSymbol(Symbol s) { ret shortenSymbol(s, shorten_default); } |
4 | |
5 | static Symbol shortenSymbol(Symbol s, int max) { |
6 | ret shortenSymbol(s, max, "..."); |
7 | } |
8 | |
9 | static Symbol shortenSymbol(Symbol s, int max, S shortener) { |
10 | if (s == null) ret emptySymbol(); |
11 | if (max < 0) ret s; |
12 | return s.length() <= max ? s : symbol(substring(str(s), 0, min(s.length(), max-l(shortener))) + shortener); |
13 | } |
14 | |
15 | static Symbol shortenSymbol(int max, Symbol s) { ret shortenSymbol(s, max); } |
Began life as a copy of #1000644
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1012681 |
Snippet name: | shortenSymbol |
Eternal ID of this version: | #1012681/2 |
Text MD5: | 2dc90c47ef0c8694ad53660e8e33b520 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-10 07:19:44 |
Source code size: | 528 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 424 / 448 |
Version history: | 1 change(s) |
Referenced in: | [show references] |