Trim a string to length