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 the Last but one, etc.).