Check documentation for `String#tr!`, this will return nil if there are no spaces. Just use `tr`.