Java Array Slice slice(String[] o, int index)

Here you can find the source of slice(String[] o, int index)

Description

Slices an array at the given index.

License

Open Source License

Parameter

Parameter Description
o The original String[] to slice
index The index at which to slice

Return

The new, processed String[]

Declaration

public static String[] slice(String[] o, int index) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   ww w  . j  a  v  a2s.c  om*/
     * Slices an array at the given index.
     * 
     * @author l3eta
     * @param o
     *            The original {@code String[]} to slice
     * @param index
     *            The index at which to slice
     * @return The new, processed {@code String[]}
     */
    public static String[] slice(String[] o, int index) {
        String[] result = new String[o.length - index];
        for (int i = index; i < o.length; i++) {
            result[i - index] = o[i];
        }
        return result;
    }
}

Related

  1. slice(byte[] source, int start, int end)
  2. slice(Object[] objects, int begin, int length)
  3. slice(String source[], int start, int end)
  4. slice(String[] array, int a, int b)
  5. slice(String[] array, int index, int length)
  6. slice(String[] strings, int begin, int length)
  7. slice(String[] strings, int begin, int length)
  8. slice(T[] array, int index)
  9. slice(T[] array, int index, int length)