When a string does not have a dotIndex[-1] the code would crash when substringing