@param array  $values
@param string $delimiter

@return string
420570
public function concat(array $values, string $delimiter = ''): string
    {
        if ($delimiter) {
            return implode(' + ' . $delimiter . ' + ', $values);
        }

        return implode(' + ', $values);
    }
1124471
public static function toCamelCase(string $input, string $delimiter = '_'): string
    {
        $str = [];

        foreach (explode($delimiter, $input) as $v) {
            $str[] = ucfirst($v);
        }

        return implode('', $str);
    }
52329
public function decode($data, $delimiter = null): array
    {
        $delimiter = $delimiter ?? $this->getDelimiter();
        $lines = preg_split('/\r\n|\r|\n/', $data);

        if ($lines === false) {
            throw new \RuntimeException('Decoding CSV failed');
        }

        // Get the field names
        $header = str_getcsv(array_shift($lines), $delimiter);

        // Get the data
        $list = [];
        foreach ($lines as $line) {
            $list[] = array_combine($header, str_getcsv($line, $delimiter));
        }

        return $list;
    }
210642
protected function decodeArrayValue($value, $delimeter = '|')
    {
        if (strpos($value, $delimeter) === false) return [$value];

        $data = preg_split('~(?<!\\\)' . preg_quote($delimeter, '~') . '~', $value);
        $newData = [];

        foreach ($data as $_value) {
            $newData[] = str_replace('\\'.$delimeter, $delimeter, $_value);
        }

        return $newData;
    }
428636
public function Explode($delimiter)
    {
        if (!$delimiter || !$string = $this->owner->value) {
            return;
        }
        $values = ArrayList::create();
        foreach (explode($delimiter, $string) as $value) {
            $values->push(
                ArrayData::create(['Value' => $value])
            );
        }
        return $values;
    }
153621
protected function buildKeyValuePairs($where, $delimiter, $isNullPatch = true)
    {
        return implode(array_map(function ($field, $value) use ($isNullPatch) {
            if (is_array($value)) {
                // Transform [field=>[0=>a,1=>b,2=>c]] to 'field in (:field_0, :field_1, :field_2)'
                return sprintf('`%s` in (%s)', $field, implode(array_map(function ($index) use ($field) {
                    return sprintf(':%s_%s', $field, $index);
                }, array_keys($value)), ', '));
            }

            // return sprintf('`%s`=:%s', $field, $field);
            // IS NULL
            if ($isNullPatch && null === $value) {
                return sprintf('`%s` IS NULL', $field);
            } else {
                return sprintf('`%s`=:%s', $field, $field);
            }
        }, array_keys($where), $where), $delimiter);
    }
563831
public function toCsv($data = null, $delimiter = null)
	{
		// csv format settings
		$newline = Arr::get($this->config, 'csv.newline', "\n");
		$delimiter or $delimiter = Arr::get($this->config, 'csv.delimiter', ',');
		$enclosure = Arr::get($this->config, 'csv.enclosure', '"');
		$escape = Arr::get($this->config, 'csv.escape', '\\');

		// escape function
		$escaper = function($items) use($enclosure, $escape) {
			return array_map(function($item) use($enclosure, $escape){
				return str_replace($enclosure, $escape.$enclosure, $item);
			}, $items);
		};

		if ($data === null)
		{
			$data = $this->data;
		}

		if (is_object($data) and ! $data instanceof \Iterator)
		{
			$data = $this->toArray($data);
		}

		// Multi-dimensional array
		if (is_array($data) and Arr::isMulti($data))
		{
			$data = array_values($data);

			if (Arr::isAssoc($data[0]))
			{
				$headings = array_keys($data[0]);
			}
			else
			{
				$headings = array_shift($data);
			}
		}
		// Single array
		else
		{
			$headings = array_keys((array) $data);
			$data = array($data);
		}

		$output = $enclosure.implode($enclosure.$delimiter.$enclosure, $escaper($headings)).$enclosure.$newline;

		foreach ($data as $row)
		{
			$output .= $enclosure.implode($enclosure.$delimiter.$enclosure, $escaper((array) $row)).$enclosure.$newline;
		}

		return rtrim($output, $newline);
	}
33434
public static function explode($delimiter, $string, $limit = null) {
        if (empty($string)) return [];
        return explode($delimiter, $string, $limit);
    }
59812
public static function multiExplode($string, array $delimiters, $keepDelimiters = true)
    {
        if ($keepDelimiters === true) {
            // Ensure special characters are escaped
            foreach ($delimiters as &$delimiter) {
                $delimiter = preg_quote($delimiter);
            }

            // RegEx fragment with delimiters
            $fragment = implode('|', $delimiters);
            $regEx = sprintf('@(?<=%s)@', $fragment);
            return preg_split($regEx, $string, -1, PREG_SPLIT_DELIM_CAPTURE);

        } else {

            $string = str_replace($delimiters, $delimiters[0], $string);
            return explode($delimiters[0], $string);
        }
    }
876016
protected function sortSeparatorsByHighestCount($line, $delimiter)
    {
        $separatorsByCount = [];

        foreach ($this->separators as $separator) {
            $data = str_getcsv($line, $separator, $delimiter);
            $count = count($data);

            if (!isset($separatorsByCount[$count])) {
                $separatorsByCount[$count] = [];
            }

            $separatorsByCount[$count][] = $separator;
        }

        $sorted = [];
        $counts = array_keys($separatorsByCount);

        rsort($counts, SORT_NUMERIC);

        foreach ($counts as $count) {
            $sorted[$count] = $separatorsByCount[$count];
        }

        return $sorted;
    }
18784
public function snakeCase($value, $delimiter = '_')
	{
		$replace = '$1'.$delimiter.'$2';

		return ctype_lower($value) ? $value : strtolower(preg_replace('/(.)([A-Z])/', $replace, $value));
	}
369419
public static function explode($string, $delimiter)
    {
        if (!String::isValid($string) ||
            String::isEmpty($string)) {
            return false;
        }

        return explode($delimiter, $string);
    }
974687
public function recvLine($delimiter = "\n") {
        $str = '';
        while (!$this->stream_eof()) {
            $char = $this->recvChr();
            $str .= $char;
            if ($char === false) { return $str; }
            if (strpos($str, $delimiter) !== false) { return $str; }
        }
        return $str;
    }
23531
public static function snake($value, $delimiter = '_')
	{
		if(! ctype_lower($value))
		{
			$value = preg_replace('/\s+/u', '', ucwords($value));
			$value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value));
		}
		return $value;
	}
317659
public function pregQuote(string $delimiter = ''): self
    {
        return new self(\preg_quote((string) $this, $delimiter), $this->encoding);
    }
357264
protected function encodeArrayValue($data, $delimeter = '|')
    {
        $newData = [];
        foreach ($data as $value) {
            if (is_array($value)) {
                $newData[] = 'Array';
            }
            else {
                $newData[] = str_replace($delimeter, '\\'.$delimeter, $value);
            }
        }

        return implode($delimeter, $newData);
    }
84318
public static function csvFields(string $line, string $delimiter = ','): array
    {
        if (trim($line) === '') {
            return [];
        }
        $fields = [];
        $parts = str_getcsv($line, $delimiter);
        if ($parts !== null && count($parts) > 0) {
            foreach ($parts as $part) {
                $part = trim($part);
                if (substr($part, 0, 1) === '"' || substr($part, 0, 1) === '\'') {
                    $part = substr($part, 1);
                }
                if (substr($part, -1) === '"' || substr($part, -1) === '\'') {
                    $part = substr($part, 0, -1);
                }
                if ($part !== '') {
                    $fields[] = $part;
                }
            }
        }
        return $fields;
    }