MathGroup Archive 2009

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

Search the Archive

Re: Finding the Position of Elements in a List that Contain

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102235] Re: [mg102157] Finding the Position of Elements in a List that Contain
  • From: Gregory Lypny <gregory.lypny at videotron.ca>
  • Date: Sun, 2 Aug 2009 05:58:54 -0400 (EDT)
  • References: <20090731232907.NREXA.9319.imail@eastrmwml48>

Ahhh, thank you, Bob!  Elegant.  Just pull out the first dimension of  
each element of StringPosition.

	Gregory


On Fri, Jul 31, 2009, at 11:29 PM, Bob Hanlon wrote:

> listOfStrings = {"The cat is here.", "It's not here.",
>   "Not in the catalogue,", "Where is the cat?"};
>
> First /@ Position[
>  StringPosition[listOfStrings, "cat"], {_, _}]
>
> {1,3,4}



  • Prev by Date: Re: Eigenvalues of sparse arrays
  • Next by Date: Re: Mapping GPS data
  • Previous by thread: Re: Finding the Position of Elements in a List that Contain
  • Next by thread: Re: Re: The audience for Mathematica (Was: Show doesn't