In brief
Interchanged boundaries have a specific behavior.
Useful to know
substring(start, end) returns a part of a string to end, without including this position. In "abcdef".substring(1, 4), the result is "bcd". If the beginning is greater than the end, the method swaps the two values . [1]
This distinguishes it from some other extraction methods. In the case of a boundary code, do not count the swapped indices to necessarily give an empty result. Positions are in UTF-16 units; cutting at random can divide complex Unicode representation. For visible symbols and words, select the appropriate processing level.
Sources
For further detail and to check the information: