MathGroup Archive 2000

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

Search the Archive

Re: extracting elements from a list?


In a message dated 9/24/2000 4:42:11 PM, ravanrip at yahoo.com writes:

>If i have the list {v$2332Period, v$2334Period, v$1231MaxAccel}
>
>How would i go about searching through this list and returning a new
>list that has only elements with the word "Period" in them.
>
>So the answer im looking for using the above list would be:
>
>newlist = {v$2332Period, v$2334Period}
>

Select[{v$2332Period, v$2334Period, v$1231MaxAccel}, 
  StringMatchQ[ToString[#], "*Period*"] &]

{v$2332Period, v$2334Period}

Cases[{v$2332Period, v$2334Period, 
      v$1231MaxAccel}, _?(StringMatchQ[ToString[#], "*Period*"] &)] == %

True


Bob Hanlon


  • Prev by Date: Re: Point inside a polygon?
  • Next by Date: InequalitySolve?
  • Previous by thread: Re: extracting elements from a list?
  • Next by thread: Re: extracting elements from a list?