MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: splitting sublists


On 16 Jun 2005, at 18:38, hrocht at mail15.com wrote:

> hi
> how to split the sublists inside a bigger list wherever we find "x"
> letter
> {{3,1,4,"x",1,5,9,2,"x"},{6,5,"x",3,5,"x",8,9,"x"}}
> the results will be:
>
> {{{3,1,4},{1,5,9,2}},{{6,5},{3,5},{8,9}}}
>
> best regards
> and thanks for this great group
> anton
>
>


DeleteCases[Split[#,#1=!="x"&&#2=!="x"&]&/@{{3,1,4,"x",1,5,9,2,"x"}, 
{6,5,"x",3,5,"x",
     8,9,"x"}},{"x"},Infinity]


{{{3, 1, 4}, {1, 5, 9, 2}}, {{6, 5}, {3, 5}, {8, 9}}}

Andrzej Kozlowski

Chiba, Japan


  • Prev by Date: Re: For Loop and Array related
  • Next by Date: Re: List operations
  • Previous by thread: splitting sublists
  • Next by thread: Re: splitting sublists