Created
October 23, 2013 11:09
-
-
Save aembleton/7116697 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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