Here you can find the source of trim(String[] data)
static String[] trim(String[] data)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { static String[] trim(String[] data) { List<String> result = new ArrayList<String>(); for (String val : data) { String trimmed = val.trim(); if (!trimmed.isEmpty()) { result.add(trimmed);/*from w w w .j av a2 s .c o m*/ } } return result.toArray(new String[] {}); } }