Does string1 begin with string2 bug or is it just me?
Posted: 05 Apr 2011 08:52
Source: Does String1 begin with String2
Code being tested with slight modification ( on WinXP)
on the command line
clearly how can "ant" begins with "testing". Is it me, or is it a bug?
Code being tested with slight modification ( on WinXP)
Code: Select all
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set string1="ant"
set string2="testing"
set s=@@@%string1%
if "%s%"=="!s:@@@%string2%!=" (
echo.%string1% doesn`t begin with %string2%
) ELSE (
echo.%string1% begins with %string2%
)
on the command line
Code: Select all
C:\work>type test.bat
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set string1="ant"
set string2="testing"
set s=@@@%string1%
if "%s%"=="!s:@@@%string2%!=" (
echo.%string1% doesnt begin with %string2%
) ELSE (
echo.%string1% begins with %string2%
)
C:\work>test.bat
"ant" begins with "testing"
clearly how can "ant" begins with "testing". Is it me, or is it a bug?