RosettaCodeData/Task/Palindrome-detection/Batch-File/palindrome-detection-2.bat
2015-02-20 00:35:01 -05:00

19 lines
407 B
Batchfile

@echo off
set /p testString=Your string (all same case please) :
call :isPalindrome result %testString: =%
if %result%==1 echo %testString% is a palindrome
if %result%==0 echo %testString% isn't a palindrome
pause
goto :eof
:isPalindrome
set %1=0
set string=%2
if "%string:~2,1%"=="" (
set %1=1
goto :eof
)
if "%string:~0,1%"=="%string:~-1%" (
call :isPalindrome %1 %string:~1,-1%
)
goto :eof