MathGroup Archive 2000

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

Search the Archive

Re: extracting elements from a list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25389] Re: [mg25379] extracting elements from a list?
  • From: BobHanlon at aol.com
  • Date: Fri, 29 Sep 2000 01:06:20 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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?