I made an A.I. using notepad, and it speaks, but im concerned because it already has over 7000 lines of code and it takes about 1 second to respond to something at the end of the code, which isnt bad, but he knows about 0.5% of the critcal information he needs to pass any test at a grade 5 level so im concerned that i may need to rearrange and shorten the code, heres what i need, i need a code in batch that searches my variable, named input, for a certain sentance, which may or may not be the full value of the variable, for example: if my input was equal to "i am going swimming" and i wanted it to see if the variable contained "i am going" and if it did it would open another batch file named "goingto.bat"
I don't see what the first lines have to do with the latter lines, and I don't understand how "I am going" relates to "goingto".
Hi there.
Nothing to do with notepad. To find a substring:
::====== script starts here ===============
:: chk for substr in var * "i am going" in "i am going swimming"
:: swim.bat 2014-01-15 17:37:30.95
@echo off & setLocal enableDELAYedeXpansioN:: V is the var
:: S is the str to find in V
:: T is a chunk of S [and then V]
:: D is the difference in length
:: O is offsetset V=i am going swimming
set S=am goingcall :sub1
call :sub2
set/a D=!len-V!-!len-S!call :main !len-S!
goto :eof
:main
set O=
for /L %%a in (0 1 !D!) do (
set T=!V:~%%a,%1!
if "!T!" equ "!S!" set O=%%a && goto :done-main
)
:done-main
if defined O (
echo.!S! found at offset !O!
) else (
echo not found
)
goto :eof:sub1
for /L %%i in (1 1 30) do (
set T=!V:~%%i,1!
if '!T!' equ '' set len-V=%%i && goto :done-sub1
)
:done-sub1
goto :eof:sub2
for /L %%i in (1 1 30) do (
set T=!S:~%%i,1!
if '!T!' equ '' set len-S=%%i && goto :done-sub2
)
:done-sub2
goto :eof
::====== script ends here ======================================
M2 Golden-Triangle
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |