Re: How to extract numbers from list elements with text?

*To*: mathgroup at smc.vnet.net*Subject*: [mg70353] Re: [mg70335] How to extract numbers from list elements with text?*From*: János <janos.lobb at yale.edu>*Date*: Sat, 14 Oct 2006 03:06:43 -0400 (EDT)*References*: <200610130530.BAA01154@smc.vnet.net>

On Oct 13, 2006, at 1:30 AM, Henning Heiberg-Andersen wrote: > Hi, > > I have a list looking like this: > > { 1 Intensity 0.23523, 2 Intensity 0.00005, 3 Intensity 0.00004, ..} > > Is there a command which allows extraction of only the last number > appearing > in each element > of the list?. If not, how can I modify the list elements? > > Best regards, > > Henning Heiberg-Andersen > Assuming that your list elements are strings, here is a newbie approach: In[1]:= lst = {"1 Intensity 0.23523", "2 Intensity 0.00005", "3 Intensity 0.00004"}; In[2]:= splst = StringSplit /@ lst Out[2]= {{"1", "Intensity", "0.23523"}, {"2", "Intensity", "0.00005"}, {"3", "Intensity", "0.00004"}} In[20]:= ToExpression /@ splst[[All,3]] Out[20]= {0.23523, 0.00005, 0.00004} János ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)

**References**:**How to extract numbers from list elements with text?***From:*"Henning Heiberg-Andersen" <henning.heibergandersen@gmail.com>