The substr function will accept two arguments. The first integer value is the index position where the extraction will start, and the second integer value is the length of the text.
The following set of examples will help you understand the substr function, and here, we declared an Str1 variable.
The second statement will extract five characters from the original, starting at index position 2.
Next, we used negative indexing. The following Str7 statement starts extracting from -3 (index position of 3 from right to left) and ends at the last position.
HINT: If you are using the Negative numbers as an index, it will start looking for items from right to left (Here, -1 is the Last Item, -2 is Last but one, etc).