Returns the substring of the text from the start index (inclusive) to the end index (optional and exclusive).