RE: Testing the Head of List Elements
- To: mathgroup at smc.vnet.net
- Subject: [mg25244] RE: [mg25200] Testing the Head of List Elements
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 17 Sep 2000 04:47:22 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Marshall,
testlist = {"string1", 50, Sin[x], "string2", 1/2, 3 + 4I};
Cases[testlist, _String]
{"string1", "string2"}
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
> -----Original Message-----
> From: Marshall Bartlett [mailto:mgb_news at hotmail.com]
To: mathgroup at smc.vnet.net
>
> I'm something of a newbie with Mathematica; please excuse my ignorance.
>
> I am looking for a clever way to select elements from a list
> based on their
> type (Head). Specifically, I want to extract all the elements of type
> dtring from a list of elements of different types (string, number,
> character, etc.).
>
> Any suggestions?
>
> --
> --------------------------------------------------------------
> Marshall Bartlett
> Department of Geology and Geophysics
> University of Utah
> mgb_news at hotmail.com
> --------------------------------------------------------------
>