getSubStringLength() errors with whitespace strings