I Want to check the string only numeric
for example
Port=1111 (which i want)
port=wjke111 (which i dont want)
how do i check above condition..
Thnaks & regards
Sivaram Nv
should be numeric only
Moderator: DosItHelp
isNumeric function
Hi Sivaram,
this should solve it.
@echo off
set myNum=%1
call :isNumeric %myNum% result
echo %result%
goto :eof
::************************
:isnumeric
setlocal
set rest=_
for /f "delims=0123456789" %%a in ("%~1") do set rest=_%%a
set return=false
if "%rest%"=="_" set return=true
( endlocal
if "%~2" NEQ "" set %~2=%return%
goto:eof
)
this should solve it.
@echo off
set myNum=%1
call :isNumeric %myNum% result
echo %result%
goto :eof
::************************
:isnumeric
setlocal
set rest=_
for /f "delims=0123456789" %%a in ("%~1") do set rest=_%%a
set return=false
if "%rest%"=="_" set return=true
( endlocal
if "%~2" NEQ "" set %~2=%return%
goto:eof
)