string should be only alphanumeric

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sivaram.nv
Posts: 4
Joined: 30 Aug 2007 02:29

string should be only alphanumeric

#1 Post by sivaram.nv » 30 Aug 2007 03:01

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

jeb
Expert
Posts: 1041
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

#2 Post by jeb » 30 Aug 2007 16:33

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
)

Post Reply