added ' ' space as an invalid character in the validateString call