Here you can find the source of removeElementInStringArray(String[] array, int index)
Parameter | Description |
---|---|
array | a parameter |
index | a parameter |
public static String[] removeElementInStringArray(String[] array, int index)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**/*from w w w . j a v a 2s . c o m*/ * Remove element element with index on array * @param array * @param index * @return */ public static String[] removeElementInStringArray(String[] array, int index) { List<String> result = new ArrayList<String>(); for (int i = 0; i < array.length; i++) { if (i != index) { result.add(array[i]); } } if (result.size() < 1) return null; return result.toArray(new String[result.size()]); } }