Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & setlocal
- mode con:cols=400 lines=80
- setlocal EnableDelayedExpansion
- :none
- cls
- echo Type a text.
- set text=nothing
- set /p text=Text:
- set text=%text:"=%
- set text=%text:^>=%
- set text=%text:^<=%
- set text=%text:,=%
- set text=%text:^^=%
- set myString=%text%
- call :strlen result myString
- echo %result%
- set Output=%text%
- set count=1
- :loop
- echo %Output%
- set "Output=!Output:~1,%result%!"
- set /a count=%count%+1
- if "%count%"=="%result%" goto stopLoop
- if "%Output%"=="" goto stopLoop
- goto loop
- :stopLoop
- pause
- goto none
- :strlen <resultVar> <stringVar>
- if "%text%"=="nothing" goto none
- (
- set "s=!%~2!#"
- set "len=0"
- for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
- if "!s:~%%P,1!" NEQ "" (
- set /a "len+=%%P"
- set "s=!s:~%%P!"
- )
- )
- )
- (
- endlocal
- set "%~1=%len%"
- exit /b
- )
- pause
- goto none
Advertisement
Add Comment
Please, Sign In to add comment