Here you can find the source of trim(String[] s)
Parameter | Description |
---|---|
s | an array of original string. |
public static String[] trim(String[] s)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { /**/* www . ja v a 2 s. co m*/ * Trims all element in given array. * * @param s * an array of original string. * @return */ public static String[] trim(String[] s) { if (s == null) { return null; } List<String> list = new ArrayList<String>(); for (String v : s) { list.add(v == null ? null : v.trim()); } return list.toArray(new String[0]); } }