RosettaCodeData/Task/String-matching/Batch-File/string-matching-4.bat
2026-04-30 12:34:36 -04:00

16 lines
385 B
Batchfile

@echo off
setlocal enableextensions enabledelayedexpansion
set /p a=
set /p b=
call :getres startsWith.bat "%a%" "%b%"
echo "%a%" starts with "%b%": %result%
call :getres endsWith.bat "%a%" "%b%"
echo "%a%" ends with "%b%": %result%
set idx=
call indexOf.bat "%a%" "%b%" idx
echo "%a%" contains "%b%" at: %idx%
goto:eof
:getres
call %1 %2 %3 && set result=No||set result=Yes
goto:eof