trim array elements of newline