Mega Code Archive

 
Categories / Java Tutorial / Collections
 

Concatenates two arrays of strings

/*  * Copyright 2000,2005 wingS development team.  *  * This file is part of wingS (http://wingsframework.org).  *  * wingS is free software; you can redistribute it and/or modify  * it under the terms of the GNU Lesser General Public License  * as published by the Free Software Foundation; either version 2.1  * of the License, or (at your option) any later version.  *  * Please see COPYING for the complete licence.  */ import java.util.StringTokenizer; /**  * Some string manipulation utilities.  *  * @author <a href="mailto:haaf@mercatis.de">Armin Haaf</a>  */ public class StringUtil {   /**    * concatenates two arrays of strings.    *    * @param s1 the first array of strings.    * @param s2 the second array of strings.    * @return the resulting array with all strings in s1 and s2    */   public static final String[] concat(String[] s1, String[] s2) {       String[] erg = new String[s1.length + s2.length];       System.arraycopy(s1, 0, erg, 0, s1.length);       System.arraycopy(s2, 0, erg, s1.length, s2.length);       return erg;   }    }