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

13
LINES

< > BotCompany Repo | #1000567 - isInteger

JavaX fragment (include)

1  
static bool isInteger(String s) {
2  
  int n = l(s);
3  
  if (n == 0) ret false;
4  
  int i = 0;
5  
  if (s.charAt(0) == '-')
6  
    if (++i >= n) ret false;
7  
  while (i < n) {
8  
    char c = s.charAt(i);
9  
    if (c < '0' || c > '9') ret false;
10  
    ++i;
11  
  }
12  
  ret true;
13  
}

download  show line numbers  debug dex   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, jozkyjcghlvl, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, wtqryiryparv

No comments. add comment

Snippet ID: #1000567
Snippet name: isInteger
Eternal ID of this version: #1000567/3
Text MD5: f6d183d11c801ec4a1fb96e06e1db2c9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-25 18:48:36
Source code size: 264 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 560 / 6911
Version history: 2 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1000567 & http://1000567.tinybrain.de