src/Collection/StringList.php
public static function fromString($string, $separator=' '){

        $string = (string)$string;

        if($separator === ''){
            return new StringList(str_split($string),'');
        }

        $prefix = '';
        $suffix = '';
        if($string[0] == $separator){
            $prefix = $separator;
        }
        if($string[strlen($string)-1] == $separator){
            $suffix = $separator;
        }
        $strList = new StringList(explode($separator,trim($string,$separator)),
                                          $separator);
        $strList->prefix = $prefix;
        $strList->suffix = $suffix;
        return $strList;
    }
public static function fromString($string, $separator=' '){

        $string = (string)$string;

        if($separator === ''){
            return new StringList(str_split($string),'');
        }

        $prefix = '';
        $suffix = '';
        if($string[0] == $separator){
            $prefix = $separator;
        }
        if($string[strlen($string)-1] == $separator){
            $suffix = $separator;
        }
        $strList = new StringList(explode($separator,trim($string,$separator)),
                                          $separator);
        $strList->prefix = $prefix;
        $strList->suffix = $suffix;
        return $strList;
    }
public static function fromString ( $ string , $ separator = ' ' ) { $ string = ( string ) $ string ; if ( $ separator === '' ) { return new StringList ( str_split ( $ string ) , '' ) ; } $ prefix = '' ; $ suffix = '' ; if ( $ string [ 0 ] == $ separator ) { $ prefix = $ separator ; } if ( $ string [ strlen ( $ string ) - 1 ] == $ separator ) { $ suffix = $ separator ; } $ strList = new StringList ( explode ( $ separator , trim ( $ string , $ separator ) ) , $ separator ) ; $ strList -> prefix = $ prefix ; $ strList -> suffix = $ suffix ; return $ strList ; }
Creates a Stringlist from a string.

@param string $string
@param string $separator
@return StringList
Creates a Stringlist from a string .