This if is unnecessary, you can just trim() without actually knowing if there are spaces.