MathGroup Archive 2004

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

Search the Archive

Re: removing letters from alphanumeric data


On May 26, 2004, at 2:41 AM, Charles Koehler wrote:

> Hello,
>
> I am able to find and read in from a data header a particular variable
> value, my difficulty is in my attempt to drop the letters that follow
> the number I need to retrieve.
>
> For example, I'll use Find to locate the position of the variable
> "Temperature" and then store the value that follows it, however there
> is generally a "C" or something after the temperature value, e.g.
> "45C".  All I need is the value 45.

My newbie approach:

alnum = "45C"

45C

StringJoin[Map[ToString, Select[ToExpression[Characters[alnum]], 
NumericQ]]]

45

János
>
> Also, If there is no entry at all is there a way to put a placeholder
> value in it place, instead a Null.
>
> Sincerely,
>
> Charles Koehler
>
>
----------------------------------------------------------
"A cyber virgin has never had intercourse outside of virtual reality, 
whereas a virtual virgin has never had intercourse with a real person 
even in virtual reality"

-Ray Kurzweil - "The age of spiritual machines"


  • Prev by Date: Re: Eigensystem: different solution in V5.0 and V4.1 [SOLVED: BUG in 5.0]
  • Next by Date: Manipulating notebooks. Request for examples
  • Previous by thread: removing letters from alphanumeric data
  • Next by thread: RE: removing letters from alphanumeric data