Libraryless. Click here for Pure Java version (5046L/28K).
static int toIntOr(O o, int defaultValue) { if (o == null) ret defaultValue; if (o instanceof Number) ret ((Number) o).intValue(); if (o cast S) ret isInteger(o) ? parseInt(o) : defaultValue; ret defaultValue; } static int toIntOr(Int i, int defaultValue) { ret i != null ? i.intValue() : defaultValue; }
Began life as a copy of #1020918
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021956 |
Snippet name: | toIntOr |
Eternal ID of this version: | #1021956/3 |
Text MD5: | 6a6754bc165b87d6786a4c8d8ec62878 |
Transpilation MD5: | 9f8a0a523331dc1f9cd00d68f5b1d599 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-01 15:42:18 |
Source code size: | 334 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 342 / 399 |
Version history: | 2 change(s) |
Referenced in: | [show references] |