Java String Array Combine combineArray(String[] array, int offset)

Here you can find the source of combineArray(String[] array, int offset)

Description

Combines the parts of a string array into a statement seperated by spaces

License

Apache License

Parameter

Parameter Description
array The array to combine
offset The starting offset in the array to start combining at.

Declaration

public static String combineArray(String[] array, int offset) 

Method Source Code

//package com.java2s;
/*//  w  w w.  jav  a  2s.  c  om
 * Copyright 2015 RITcraft & Chris Bitler
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    /**
     * Combines the parts of a string array into a statement seperated by spaces
     * @param array The array to combine
     * @param offset The starting offset in the array to start combining at.
     * @return
     */
    public static String combineArray(String[] array, int offset) {
        String combination = "";
        for (int i = offset; i < array.length; i++) {
            combination += (array[i] + " ");
        }
        return combination;
    }
}

Related

  1. combine(String[] values, String separator)
  2. combine(String[] words)
  3. combineArray(String separator, String... stringArray)
  4. combineArray(String[] a, String[] b)
  5. combineArray(String[] args)
  6. combineArray(String[] str, int start, int end)
  7. combineArrays(String[] array1, String[] array2)
  8. combineSplit(final int startIndex, final String[] string, final String seperator)
  9. combineSplit(int startIndex, String[] string, String separator)