general/misc/
str_element.pro
Routines
top source str_element
str_element, struct, tagname, value, ADD_REPLACE=ADD_REPLACE, DELETE=DELETE, CLOSEST=CLOSEST, SUCCESS=SUCCESS, VALUE=VALUE, INDEX=INDEX
PROCEDURE: str_element, struct, tagname, value PURPOSE: Find (or add) an element of a structure. This procedure will not Input: struct, generic structure tagname, string (tag name) Output: value, Named variable in which value of the structure element is returned. Purpose: Retrieves the value of a structure element. This function will not produce an error if the tag and/or structure does not exist. KEYWORDS: SUCCESS: Named variable that will contain a 1 if the element was found or a 0 if not found. INDEX: a named variable in which the element index is returned. The index will be -2 if struct is not a structure, -1 if the tag is not found, and >= 0 if successful. ADD_REPLACE: Set this keyword to add or replace a structure element. DELETE: Set this keyword to delete the tagname. CLOSEST: Set this keyword to allow near matchs (useful with _extra) VALUE: (obsolete) alternate method of returning value. (Will not work with recursion) Notes: 1. Value remains unchanged if the structure element does not exist. 2. If tagname contains a '.' then the structure is recursively searched and index will be an array of indices. 3. If struct is an array then results may be unpredictable. 4. Elements may be inserted into embedded structures, by including the embedded structure name in the tagname string.(example below) Examples: Does an element exist? str_element,my_str,'my_tag_name',SUCCESS=s What is an element's value? str_element,my_str,'my_tag_name',v Add an element str_element,my_str,'my_tag_name','value',/add Add an element to embedded structure: str_element,my_str,'my_substr_name.my_tag_name','value',/add Modifications: 5/7/97: Added recursive searching of structure hierarchy. D. Larson 2014-1-20 : Added mulidimensional elements for arrays of structures CREATED BY: Davin Larson FILE: str_element.pro VERSION 1.10 LAST MODIFICATION: 01/10/08 CREATED BY: Davin Larson $LastChangedBy: $ $LastChangedDate: $ $LastChangedRevision: $ $URL: $
Parameters
- struct
- tagname
- value
Keywords
- ADD_REPLACE
- DELETE
- CLOSEST
- SUCCESS
- VALUE
- INDEX
File attributes
Modification date: | Thu Feb 13 16:43:48 2014 |
Lines: | 128 |