Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1019477 // toIntOpt

JavaX fragment (include)

1  
static int toIntOpt(O o, int defaultValue default 0) {
2  
  if (o == null) ret defaultValue;
3  
  if (o instanceof Number)
4  
    ret ((Number) o).intValue();
5  
  if (o instanceof S)
6  
    ret parseIntOpt((S) o);
7  
  ret defaultValue;
8  
}

Author comment

Began life as a copy of #1002621

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019477
Snippet name: toIntOpt
Eternal ID of this version: #1019477/2
Text MD5: e5746682637e6813aaa8f3a7a486a678
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 09:20:45
Source code size: 228 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 303 / 336
Version history: 1 change(s)
Referenced in: [show references]