Libraryless. Click here for Pure Java version (2158L/14K).
1 | static int toInt(O o) {
|
2 | if (o == null) ret 0; |
3 | if (o cast Number) |
4 | ret o.intValue(); |
5 | if (o cast S) |
6 | ret parseInt(o); |
7 | if (o cast Bool) |
8 | ret boolToInt(o); |
9 | throw fail("woot not int: " + getClassName(o));
|
10 | } |
11 | |
12 | static int toInt(long l) {
|
13 | if (l != (int) l) fail("Too large for int: " + l);
|
14 | ret (int) l; |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1002621 |
| Snippet name: | toInt |
| Eternal ID of this version: | #1002621/3 |
| Text MD5: | 8294c654949d3c90652aefd682dd0488 |
| Transpilation MD5: | 5c00ea5cefb847edd0ec3e26140e0cb0 |
| Author: | stefan |
| Category: | javax / eleu |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-01-11 20:28:59 |
| Source code size: | 332 bytes / 15 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1465 / 2476 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |