Here you can find the source of trimRecords(String[] records)
public static String[] trimRecords(String[] records)
//package com.java2s; /******************************************************************************* * Educational Online Test Delivery System * Copyright (c) 2013 American Institutes for Research * /* w ww .j a va 2s .c o m*/ * Distributed under the AIR Open Source License, Version 1.0 * See accompanying file AIR-License-1_0.txt or at * http://www.smarterapp.org/documents/American_Institutes_for_Research_Open_Source_Software_License.pdf ******************************************************************************/ import java.util.Arrays; public class Main { public static String[] trimRecords(String[] records) { return Arrays.copyOf(trimTextValues(records), records.length, String[].class); } public static Object[] trimTextValues(Object[] records) { Object[] trimmedRecordArray = new Object[records.length]; for (int i = 0; i < records.length; i++) { Object record = records[i]; if (record instanceof String || record instanceof Number) { trimmedRecordArray[i] = record.toString().trim(); } else { trimmedRecordArray[i] = record; } } return trimmedRecordArray; } }