Created
December 6, 2012 23:47
-
-
Save davidruhmann/4229480 to your computer and use it in GitHub Desktop.
[Batch] Numeric validation methods.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:IsDecimal <xReturn> <xInput> [xDelims] | |
:: Return true if the input is a decimal 10.0 number, else return false. | |
:::: Only allows for period seperator unless specified by xDelims. ,[tab][space] | |
call :IsNumber %1 %2 %3 | |
goto :eof | |
:: by David Ruhmann |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:IsNumber <xReturn> <xInput> [xDelims] | |
:: Return true if the input is a base 10 number, else return false. | |
:::: Does not allow any seperators unless specified by xDelims. ,.[tab][space] | |
setlocal | |
if not "%~2"=="" set "xResult=true" | |
for /f "tokens=1 delims=1234567890%~3" %%n in ("%~2") do set xResult=false | |
endlocal & if not "%~1"=="" set "%~1=%xResult%" | |
goto :eof | |
:: by David Ruhmann |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment