Combine all the data into strings.

For every array in the data all strings will be multiplied by the number of items in that
array to cover every possible string combination.

@param array $data
@param string $separator

@return string[]
971082
protected function combine(array $data, $separator)
    {
        $results = array_shift($data);
        $results = is_array($results) ? $results : [$results];

        while ($value = array_shift($data)) {
            if (is_array($value)) {
                $replacement = [];

                foreach ($value as $array_value) {
                    foreach ($results as $result_value) {
                        $replacement[] = $result_value . $separator . $array_value;
                    }
                }

                $results = $replacement;
            } else {
                foreach ($results as $key => $result_value) {
                    $results[$key] = $result_value . $separator . $value;
                }
            }
        }

        return array_filter($results);
    }
212875
public static function decodeObject(String $data, String $key = NULL, String $separator = NULL) : stdClass
    {
        return self::decode($data, $key, $separator);
    }
276301
public function splitTagNames($names, $separator=',')
    {
        $tags = explode($separator, $names);
        $tags = array_map('trim', $tags);
        $tags = array_filter($tags, function ($value) { return !empty($value); });

        return array_values($tags);
    }
1367212
public static function explode($separator, $data, $number = null, $callback = 'array_push')
    {
        if ($number) {
            $array = explode($separator, $data, $number);
        } else {
            $array = explode($separator, $data);
        }

        if (count($array) < $number) {
            foreach (range(1, $number - count($array)) as $i) {
                $callback($array, null);
            }
        }

        return $array;
    }
1079716
public static double[] stringToDoubleArray( String string, String separator ) {
        if (separator == null) {
            separator = ",";
        }
        String[] stringSplit = string.trim().split(separator);
        double[] array = new double[stringSplit.length];
        for( int i = 0; i < array.length; i++ ) {
            array[i] = Double.parseDouble(stringSplit[i].trim());
        }
        return array;
    }
25518
public function explode($delimiter): array
    {
        Assert::typeOf(['string', __CLASS__], $delimiter);

        $response = [];
        $results  = explode((string) $delimiter, $this->data);

        if ($results === false) {
            throw new RuntimeException('An unknown error occurred while splitting string!');
        }

        foreach ($results as $result) {
            $response[] = new static($result, $this->encoding);
        }

        return $response;
    }
975606
public function concatenate($values, $separator = null)
	{
		if ($separator)
		{
			$concat_string = 'CONCAT_WS(' . $this->quote($separator);

			foreach ($values as $value)
			{
				$concat_string .= ', ' . $value;
			}

			return $concat_string . ')';
		}

		return 'CONCAT(' . implode(',', $values) . ')';
	}
162241
public static String format( Collection<String> items, String separator ) {

		StringBuilder sb = new StringBuilder();
		for( Iterator<String> it = items.iterator(); it.hasNext(); ) {
			sb.append( it.next());
			if( it.hasNext())
				sb.append( separator );
		}

		return sb.toString();
	}
164727
public static function merge(array $templates, $separator = "\n")
    {
        $output = "";

        if (!is_string($separator))
            throw new InvalidArgumentException(
                "Expected string for separator.", 
                1
            );
            
        foreach ($templates as $template) {
            if ($template instanceof TemplateInterface)
                $output .= $template->output() . $separator;
            else
                throw new InvalidArgumentException(
                    "Expected Template objects.", 
                    1
                );
        }
        return $output;
    }
1057795
public static function join($strings, $separator, $start = 0, $count = -1)
    {
        $string = '';

        $end = $count == -1 ? Collection::count($strings) : $count;

        for ($i = $start; $i < $end; $i++) {
            $string .= $strings[$i].$separator;

            if ($i == ($end - 1)) {
                $string .= $separator;
            }
        }

        return $string;
    }
1356476
public static String join(final Object array, final String separator) {
		$.checkNotEmpty(array);
		Class<?> arrayType = array.getClass();
		Preconditions.checkArgument(arrayType.isArray(), "parameter array must be Array: %s", array);

		StringBuffer sb = new StringBuffer();
		sb.append(Array.get(array, 0));

		int length = Array.getLength(array);
		for (int i = 1; i < length; i++) {
			sb.append(separator).append(Array.get(array, i));
		}

		return sb.toString();
	}
722307
public static function convertStringToArray($str, $seperator = ',', $limit = PHP_INT_MAX)
    {
        return self::removeEmptyItems(explode($seperator, $str, $limit), function ($param) {
            return self::trimQuots($param);
        });
    }
479395
public static function arrayToString($arr, $separator = ',', $comma = '\'')
    {
        $result = array_reduce($arr, function ($carry, $param) use ($separator, $comma) {
            $segment = $comma . $param . $comma;
            return $carry ? $carry . "{$separator} {$segment}" : "{$segment}";
        }, null);
        return $result;
    }
458322
public static String arrayJoin(List<String> arr, String separator) {
		return (arr == null || separator == null) ? "" : StringUtils.join(arr, separator);
	}
1066478
public static String implode(int[] values, String separator) {
        StringBuffer result = new StringBuffer();
        for (int i = 0; i < values.length; i++) {
            if (i > 0)
                result.append(separator);
            result.append(values[i]);
        }
        return result.toString();
    }
609247
public static function dimensionizeArray($array, $separator = '.')
    {
        $dimArray = array();
        
        foreach ($array as $key => $value) {
            $key = trim($key, $separator);
            // checks if the key is a path
            if (strpos($key, $separator) !== false) {
                $parts = self::splitArrayPath($key, $separator);
                $firstPart = array_shift($parts);
                // recursively dimensionize the key
                $value = self::dimensionizeArray(array(implode($separator, $parts) => $value), $separator);
                
                if (isset($dimArray[$firstPart])) {
                    if (!is_array($dimArray[$firstPart])) {
                        // if $firstPart exists but is not an array, drops the value and use an array
                        $dimArray[$firstPart] = array();
                    }
                    // merge recursively both arrays
                    $dimArray[$firstPart] = self::mergeRecursive($dimArray[$firstPart], $value);
                } else {
                    $dimArray[$firstPart] = $value;
                }
                
            } else if (is_array($value)) {
                // dimensionize sub arrays
                $value = self::dimensionizeArray($value, $separator);
                if (isset($dimArray[$key])) {
                    $dimArray[$key] = self::mergeRecursive($dimArray[$key], $value);
                } else {
                    $dimArray[$key] = $value;
                }
            } else {
                $dimArray[$key] = $value;
            }
        }
        
        return $dimArray;
    }
1293190
public static function explode(string $separator, string $content, ?callable $itemFunction = null): array
    {
        if ($separator === "\n") {
            $content = str_replace("\r", '', $content);
        }
        $items = explode($separator, $content);
        if (is_callable($itemFunction)) {
            foreach ($items as $index => $item) {
                $items[$index] = $itemFunction($item);
            }
        }
        return $items;
    }