trim and then check isEmpty()?