Truncate a string to length keeping word boundary