Page 1 of 1

string should be only alphanumeric

Posted: 30 Aug 2007 03:01
by sivaram.nv
Hi

I Have one problem ,I Taking input from one string that need to be alpha numeric.

string=Sivaram001----->(i want this formate)

string=S*&^*&varam0!!
(this i need to be reject because it is having special characters)

how do i do that if you have any solutions please let me know

advance thanks

Sivaram Nv

Posted: 30 Aug 2007 16:33
by jeb
Hi,

nearly the same like :isNumeric.

::************************
:isAlphaNumeric
setlocal
set rest=_
for /f "delims=0123456789abcdefghijklmnopqrstuvwxyz" %%a in ("%~1") do set rest=_%%a
set return=false
if "%rest%"=="_" set return=true
( endlocal
if "%~2" NEQ "" set %~2=%return%
goto:eof
)