Introduction
Have you ever wonder is there any substring function or alike language construct to get a portion of the string ? I always do.. and here's some examples on how to do that.Syntax / Construction
:~start,length
Notes
- start : is the start position of the text ( index begin from 1 ).
- length : length of the portion of text extracted.
Get "Hello" part from "Hello World" text, i.e. text portion from position 1 to 5 of the original text.
set mytext="Hello World"
echo %mytext:~1,5%
echo %mytext:~1,5%
Result :
