MathGroup Archive 2002

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

Search the Archive

Re: ReadList with mixed strings and numbers


Hi,
one possibility is:

MixedRead[str_String, numformat_:{Number, Number}] := Block[{f, numcheckQ},
        f = ReadList[str, String];
        numcheckQ = (Complement[Characters[#],
         {"0","1","2","3","4","5","6","7","8","9","E","e","-",
          "+","^"," ",".", "\n","\r","\t"}     ] === {} )&;
        Table[If[numcheckQ[f[[i]]], 
        Read[StringToStream[f[[i]]], numformat], f[[i]]], {i, Length[f]} ] ]

--
Dr. Rolf Mertig
Mertig Consulting, Berlin, Germany
(web)Mathematica Programming and Training
http://www.mertig.com



  • Prev by Date: inverse square law attraction
  • Next by Date: Re: Does Mathematica runs in Windows XP?
  • Previous by thread: ReadList with mixed strings and numbers
  • Next by thread: Sorting with absolute precision