How would I do to use the variable %number% in this case?
Set Test=%strToMeasure:~-%Number%%
Whenever I use a variable the result comes out like this:
No variable only the number:
Set Test=%strToMeasure:~-3%
With variable:
Set Test=%strToMeasure:~-%Number%%
Full Code
@echo off
Set "strToMeasure=This is a string"
call :strLen strToMeasure strlen
echo.String is %strlen% characters long
Set /A number = %strlen% - 13
Set Test=%strToMeasure:~-%Number%%
Echo %strToMeasure%
Echo %Test%
pause
exit /b
:strLen
setlocal enabledelayedexpansion
:strLen_Loop
if not "!%1:~%len%!"=="" set /A len+=1 & goto :strLen_Loop
(endlocal & set %2=%len%)
goto :eof