According to the documentation: https://docs.inductiveautomation.com/display/DOC81/substring, the indexes (startIndex, endIndex) of the substring() function should start at zero. So, to get the substring “urge” inside the string “hamburger”, you would have to execute substring(“hamburger”, 4, 7), but you really have to execute substring(“hamburger”, 4, 8). Why?
The documentation says exactly: Substring will return the portion of the string from the startIndex to the endIndex, or end of the string if endIndex is not specified. All indexes start at 0.