Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2011

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

Search the Archive

parsing a strig

  • To: mathgroup at
  • Subject: [mg119832] parsing a strig
  • From: Ted Sariyski <tsariysk at>
  • Date: Fri, 24 Jun 2011 07:47:16 -0400 (EDT)
  • References: <>

I import a text file with Import[filename,"Table"]. The file has a 
header followed by data. The header contains predefined keywords like 
TITLE, ZONE, VARIABLES, etc.  A VARIABLES line, shown below, is a list 
of 'varname,varunits' pairs, which I need to extract as pairs.


I tried StringSplit[varList,"'"] but got
Out[]:  {{um,,,I_p},{(W/sr/um),,,I_a},{(W/sr/um),,,I_ae},...}}, which is 

I tried StringSplit[Drop[vars, 2], "'"] and got
Out[]: {{I_a (W/sr/um)},{I_ae (W/sr/um)},...}}, which miss the first 
variable 'um'.

How can I parse this?
Thanks in advance,

  • Prev by Date: Re: Export a Grid[] object without loosing it's format
  • Next by Date: Re: pattern example
  • Previous by thread: Automatic Equation Numbering when "save as"Latex
  • Next by thread: DSolve gives different answer to NDSolve