Skip to content

Commit

Permalink
Update isInteger.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
npocmaka authored Oct 25, 2017
1 parent ec4fa08 commit 533b9ca
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions math/isInteger.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
@echo off
@echo off

:isInterer input [returnVar]
setlocal enableDelayedexpansion
set "input=%~1"
:isInterer input [returnVar]
setlocal enableDelayedexpansion
set "input=%~1"

if "!input:~0,1!" equ "-" set "input=!input:~1!"

for %%# in (1 2 3 4 5 6 7 8 9 0) do (
set "input=!input:%%#=!"
)

if "!input!" equ "" (set result=true
if "!input:~0,1!" equ "-" (
set "input=!input:~1!"
) else (
set result=false
if "!input:~0,1!" equ "+" set "input=!input:~1!"
)

endlocal & if "%~2" neq "" (set %~2=%result%) else echo %result%
for %%# in (1 2 3 4 5 6 7 8 9 0) do (
if not "!input!" == "" (
set "input=!input:%%#=!"
)
)

if "!input!" equ "" (
set result=true
) else (
set result=false
)

endlocal & if "%~2" neq "" (set %~2=%result%) else echo %result%

0 comments on commit 533b9ca

Please sign in to comment.