Trim array elements