MathGroup Archive 2007

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

Search the Archive

Re: Finds strings in a list that begin with "A"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82363] Re: [mg82267] Finds strings in a list that begin with "A"
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Thu, 18 Oct 2007 04:59:14 -0400 (EDT)
  • References: <12170776.1192646376451.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

strings = {"And", "Bat", "Artistic", "Cob"};
Flatten@StringCases[strings, "A" ~~ ___]

{"And", "Artistic"}

or

Pick[strings, StringMatchQ[strings, "A" ~~ __]]

{"And", "Artistic"}

Bobby

On Wed, 17 Oct 2007 02:44:15 -0500, <tomfabtastic at hotmail.com> wrote:

> Hello,
>
> I am trying to look through a list of strings and return all strings
> that start with an "A".
>
> For example, my list could be :
>
> {"And", "Bat", "Artistic", "Cob"} so I want to return {"And",
> "Artistic"}.
>
> Any ideas ?
>
> Thanks,
> Tom
>
>
>



-- =

DrMajorBob at bigfoot.com


  • Prev by Date: Re: Finds strings in a list that begin with "A"
  • Next by Date: GraphicsGrid
  • Previous by thread: Re: Finds strings in a list that begin with "A"
  • Next by thread: Integer Points on elliptic curve