I prefer endIndex == nil be the check, it's just easier for me to read than a negation.