Ben: Would you be willing to share your solutions with the readers? Sincerely, Craig T. Dedo 17130 W. Burleigh Place P. O. Box 423 Mobile Phone: (414) 412-5869 Brookfield, WI 53008-0423 E-mail: <[log in to unmask]> USA Linked-In: http://www.linkedin.com/in/craigdedo > -----Original Message----- > From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of bennie > blackwell > Sent: Thursday, March 17, 2011 17:31 > To: [log in to unmask] > Subject: Re: data parsing with F90 > > Thanks to all of you that responded to my question 'data parsing with F90'. > I now have several possible solutions. > Ben Blackwell > > -----Original Message----- > From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of > W.J. Metzger > Sent: Thursday, March 17, 2011 3:24 AM > To: [log in to unmask] > Subject: Re: data parsing with F90 > > I've written a module containing several routines to manipulate words in > strings, where a word is usually defined as blank delimited, although a > couple of the routines allow any given character as the delimiter. > It will do what you want, but may not be any better than your parse.f > > Function WORDS(string) will return the number of blank-delimited words, > 17 in the case of your example, and Subroutine WordParse will parse a > string into an array of strings, each containing a 'word' - an arbitrary > delimiter can be specified. > > You can get the module from > > http://www.hef.ru.nl/~wes/programs.html > > Good luck, > > Wes > > On Wed, 2011-03-16 at 09:28 -0600, bennie blackwell wrote: > > I have a need to parse a character string of chemical species to 1) > > determine the number of species and then 2) read the individual > > species as character variables. An example might be the space > > delimited record for the following 17 species: > > > > > > > > N2 C O O2 CO2 CO N NO NO2 CN C3 C2 C2N2 C5 C4 C4N2 C20 > > > > > > > > I have an old f77 program (parse.f) written by a colleague in 1988 and > > modified by myself in 1991 that allows a variety of delimiters, > > including space, comma, <, =, and >. I could run parse.f through a F77 > > to F90 converter and move forward. However, I am looking for a more > > modern F90 approach. Is there a better approach than parsing each > > character individually, checking to see if the single character > > matches the allowable delimiter characters and mucking around in > > general. > > > > > > Thanks, > > > > Ben Blackwell > > > > Blackwell Consulting > > > > PO Box 2879 > > > > Corrales, NM 87048 > > > > 505-897-5090 > > > > (fax) 505-890-4992 > > > > [log in to unmask] > > > -- > Dr. W. J. Metzger Experimental High Energy Physics Group > tel. +31-24-3653127 Faculty of Science > +31-24-3652099 (secr.) Radboud University Nijmegen > fax. +31-24-3652191 Heyendaalseweg 135 > 6525 AJ Nijmegen, The Netherlands > e-mail: [log in to unmask] or [log in to unmask] > http://home.cern.ch/metzger/ or http://www.hef.ru.nl/~wes