For Command not Reading Spaces in Words
Posted: 12 May 2013 04:23
Hello people.
I've been using this code to capture chars form phrases (!k wrote it here)
But whenever I change %word% to a word with spaces it won't capture anything that is in front of the space and the space.
Here's an exemple code of !k's code in action with spaces:
Can somebody help me fix it to work with spaces ?
If you knows how please help me.
And Thanks for reading
I've been using this code to capture chars form phrases (!k wrote it here)
Code: Select all
@echo off &setlocal enableextensions
set "word=everyone!"
call :ch "%word%"
set char
goto :eof
:ch
for /l %%c in (0,1,127) do (
set "w=%~1"
call set "char#%%c=%%w:~%%c,1%%"
)
goto :eof
But whenever I change %word% to a word with spaces it won't capture anything that is in front of the space and the space.
Here's an exemple code of !k's code in action with spaces:
Code: Select all
@echo on &setlocal enableDelayedExpansion
@echo on &setlocal enableextensions
:ft2deccharsetter
set "caller=hello hello"
call :ch %caller%
set dis=1
:dis
echo !char#%dis%!
set /a dis+=1
if %dis%==12 set char &echo Supposadly there should be 11 chars to echo but instead it only echos until it reaches the sapce (char 5) &pause
goto dis
:ch
@echo off
for /l %%c in (0,1,127) do (
set "w=%~1"
call set "char#%%c=%%w:~%%c,1%%"
)
@echo on
goto :eof
Can somebody help me fix it to work with spaces ?
If you knows how please help me.
And Thanks for reading