Here you can find the source of combine(String[] a, String[] b, String glue)
Parameter | Description |
---|---|
a | First string array. |
b | Second string array. |
glue | The delimiter string. |
public static String[] combine(String[] a, String[] b, String glue)
//package com.java2s; /**//w w w .ja va 2 s . c o m * @author Charles McGarvey * The TopCoder Arena editor plug-in providing support for Vim. * * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. */ public class Main { /** * Combined string elements from two arrays into a single array, gluing * together elements of the same index with a delimiter string. * @param a First string array. * @param b Second string array. * @param glue The delimiter string. * @return The combined array. */ public static String[] combine(String[] a, String[] b, String glue) { String[] result = new String[Math.min(a.length, b.length)]; for (int i = 0; i < result.length; ++i) { result[i] = a[i] + glue + b[i]; } return result; } }