Here you can find the source of range(String input[], int beginIndex, int endIndex)
Parameter | Description |
---|---|
input | string table |
beginIndex | first element of the range |
endIndex | last element of the range |
public static String[] range(String input[], int beginIndex, int endIndex)
//package com.java2s; /*/*from w w w . ja va 2 s .c o m*/ * IrssiBot - An advanced IRC automation ("bot") * Copyright (C) 2000 Matti Dahlbom * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * mdahlbom@cc.hut.fi */ public class Main { /** * returns a range of a string table elements as a new string table * @param input string table * @param beginIndex first element of the range * @param endIndex last element of the range * @return range */ public static String[] range(String input[], int beginIndex, int endIndex) { String ret[] = null; if (input != null) { if ((beginIndex >= 0) && (endIndex < input.length) && (beginIndex <= endIndex)) { ret = new String[endIndex - beginIndex + 1]; for (int i = beginIndex; i <= endIndex; i++) { ret[i - beginIndex] = input[i]; } } } return ret; } /** * returns a range of a string table elements as a new string table * starting from beginIndex to end of the input table. * @param input string table * @param beginIndex first element of the range * @return range */ public static String[] range(String input[], int beginIndex) { return range(input, beginIndex, input.length - 1); } }