Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::prerequirement: create_string function
- @echo off
- goto :main
- :set_index
- call create_string %~1[%~2] "!%~3!"
- goto :eof
- :main
- call create_string delimiter %2
- call create_string content %3
- set /a offset=0
- set /a index=0
- for /l %%g in ( 0, 1, %content_lenght% ) do (
- set character=!content:~%%g,1!
- if "!character!" equ "!delimiter!" (
- set /a lenght=%%g-!offset!
- call :set_index %1 !index! "content:~!offset!,!lenght!"
- set /a offset=%%g + 1
- set /a index=!index! + 1
- )
- )
- call :set_index %1 !index! content:~%offset%,%content_lenght%
- set /a %1_lenght=%index% + 1
- set %1=%content%
- set content=
- set lenght=
- set offset=
- set character=
- set delimiter=
- set index=
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment