parsing a strig
- To: mathgroup at smc.vnet.net
 - Subject: [mg119832] parsing a strig
 - From: Ted Sariyski <tsariysk at craft-tech.com>
 - Date: Fri, 24 Jun 2011 07:47:16 -0400 (EDT)
 - References: <201106231125.HAA25913@smc.vnet.net>
 
Hi,
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.
{{VARIABLES,=,'um','I_p,(W/sr/um)','I_a,(W/sr/um)','I_ae,(W/sr/um)','m','I_p,(W/sr/m)','I_a,(W/sr/m)','I_ae,(W/sr/m)'}}
I tried StringSplit[varList,"'"] but got
Out[]:  {{um,,,I_p},{(W/sr/um),,,I_a},{(W/sr/um),,,I_ae},...}}, which is 
wrong.
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,
--Ted
- References:
- Automatic Equation Numbering  when "save as"Latex
- From: graser <graser@gmail.com>
 
 
 - Automatic Equation Numbering  when "save as"Latex