Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Testing the Head of List Elements

  • To: mathgroup at
  • Subject: [mg25249] Re: Testing the Head of List Elements
  • From: leko at (J. Leko)
  • Date: Sun, 17 Sep 2000 04:47:28 -0400 (EDT)
  • References: <8psf4k$>
  • Sender: owner-wri-mathgroup at


One way of accomplishing this is to use the Select command, with the
StringQ test condition. For example, try the following:

In[7]:= Select[{"a", 23.0, \[Alpha], 4, "376", -7}, StringQ]

Out[7]= {"a", "376"}

Note that if your list has already been assigned a name, then simply
substitute it in place of the list.


J. Leko
University of Alabama in Huntsville

Please reply to leko*j at and remove the *

In article <8psf4k$9n1 at>, "Marshall Bartlett"
<mgb_news at> wrote:

> 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
> --------------------------------------------------------------

  • Prev by Date: Use of Miscellaneous`RealOnly` Package
  • Next by Date: Re: How to display the desired numerical precision?
  • Previous by thread: Re: Testing the Head of List Elements
  • Next by thread: Re: Testing the Head of List Elements