/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */

package org.apache.gshell.util;

/**
 * Common <code>String</code> manipulation routines from <tt>org.codehaus.plexus:plexus-utils</tt>.
 * 
 * @since 2.0
 */
public class Strings
{
    /**
     * <p>Joins the elements of the provided array into a single String
     * containing the provided list of elements.</p>
     * <p/>
     * <p>No delimiter is added before or after the list. A
     * <code>null</code> separator is the same as a blank String.</p>
     *
     * @param array     the array of values to join together
     * @param separator the separator character to use
     * @return the joined String
     */
    public static String join(Object[] array, String separator) {
        if (separator == null) {
            separator = "";
        }
        int arraySize = array.length;
        int bufSize = (arraySize == 0 ? 0 : (array[0].toString().length() +
                separator.length()) * arraySize);
        StringBuffer buf = new StringBuffer(bufSize);

        for (int i = 0; i < arraySize; i++) {
            if (i > 0) {
                buf.append(separator);
            }
            buf.append(array[i]);
        }
        return buf.toString();
    }
    
    /**
     * <p>Repeat a String <code>n</code> times to form a
     * new string.</p>
     *
     * @param str    String to repeat
     * @param repeat number of times to repeat str
     * @return String with repeated String
     * @throws NegativeArraySizeException if <code>repeat < 0</code>
     * @throws NullPointerException       if str is <code>null</code>
     */
    public static String repeat(String str, int repeat) {
        StringBuffer buffer = new StringBuffer(repeat * str.length());
        for (int i = 0; i < repeat; i++) {
            buffer.append(str);
        }
        return buffer.toString();
    }
}
@@ -991,447 +991,8 @@
     
-/**%0A     * %3Cp%3EJoins the elements of the provided array into a single String%0A     * containing the provided list of elements.%3C/p%3E%0A     * %3Cp/%3E%0A     * %3Cp%3ENo delimiter is added before or after the list. A%0A     * %3Ccode%3Enull%3C/code%3E separator is the same as a blank String.%3C/p%3E%0A     *%0A     * @param array     the array of values to join together%0A     * @param separator the separator character to use%0A     * @return the joined String%0A     */%0A    
 publ
@@ -1013,16 +1013,22 @@
 ng join(
+final 
 Object%5B%5D
@@ -1563,127 +1563,29 @@
     
-/**%0A     * %3Cp%3ERepeat a String %3Ccode%3En%3C/code%3E times to form a%0A     * new string.%3C/p%3E%0A     *%0A     * @param str   
+public static
  String 
 to r
@@ -1584,302 +1584,38 @@
 ing 
-to 
 repeat
-%0A     * @param repeat number of times to repeat str%0A     * @return String with repeated String%0A     * @throws NegativeArraySizeException if %3Ccode%3Erepeat %3C 0%3C/code%3E%0A     * @throws NullPointerException       if str is %3Ccode%3Enull%3C/code%3E%0A     */%0A    public static String repeat(String str,
+(final String str, final
  int

Remove need for plexus-utils