TXTGETKEY Name
TXTGETKEY Purpose
Get a keyword value from a string array.
Category
Calling Sequence
val = txtgetkey(key) Inputs
key = keyword to find. Case ignored. in
Keyword Parameters
Keywords
INIT=txtarr string array to search. Must be given as an
initialization array before asking for values. If txtarr
stays the same it need be given only on first call.
DELIMITER=del Set keyword/value delimiter (def is =).
/LIST lists keywords and values.
/STRUCTURE return all keywords and values in a structure.
Repeated keywords returned as an array in structure.
Can check returned structure for a tag using tag_test().
Beware that IDL reserved words if used as keywords
will cause an error (not allowed as structure tags).
/NOSORT inhibits tag name sort when returning a structure.
Sort only needed if repeated tags not adjacent.
TYPE=typ Use with /STRUCTURE to convert values to a data
type other than the default string. Must give an array
of type codes (as returned by the size function), one for
each item in the returned structure and in the same
order (may differ with /SORT). Remember that repeated
keywords are returned as an array, counted as one item in
the structure so give only one type code for the array.
/START start search at beginning of array, else
continue from last position (can pick up multiple
copies of a keyword by not using /START).
INDEX=indx Index where key was found.
Outputs
val = returned value of keyword. out
Null string if key not found.
Common Blocks
txtgetkey_com Notes
Notes: File must contain keywords and values separated by an
equal sign (=) or DELIM. When a matching keyword is found
everything following the equal is returned as a text
string. Spaces are optional. Some examples:
title = This is a test.
n=128
xrange = 10, 20
Example call: v = txtgetkey(init=txt, key).
Comment lines have * as first non-blank character.
Comment lines and blank lines are ignored so may be used.
Modification History
R. Sterner, 17 Mar, 1993
R. Sterner, 25 Oct, 1993 --- Added DELIMITER keyword.
R. Sterner, 1994 May 6 --- Added /START and fixed minor bugs.
R. Sterner, 1995 Jun 26 --- Added INDEX keyword.
R. Sterner, 2001 May 23 --- Added /STRUCTURE keyword.
R. Sterner, 2002 Jul 01 --- Allowed repeated keywords with structure.
R. Sterner, 2003 May 22 --- Minor cleanup, help text.
R. Sterner, 2003 May 22 --- Allowed comment char after 1st col.
R. Sterner, 2004 Mar 25 --- Added /NOSORT keyword.
R. Sterner, 2005 Sep 07 --- Added comment on IDL reserved words.
R. Sterner, 2006 Sep 06 --- Allowed an optional type code array.
R. Sterner, 2006 Sep 24 --- Used typ[]instead of typ().
R. Sterner, 2010 May 04 --- Converted arrays from () to [].
Copyright (C) 1993, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.