Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package uk.transactis.csvParsing.util;
public class ArrayUtil {
* Trims all elements of an array without side affect.
* @param array
* Array from which to base the output array
* @return A new array that equals input array but with each element
* trimmed.
public static String[] trimArray(String[] array) {
String[] trimmedArray = new String[array.length];
for (int i = 0; i < array.length; i++) {
trimmedArray[i] = array[i].trim();
return trimmedArray;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.