comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Finding if a structure tag name is defined?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Finding if a structure tag name is defined? [message #36688] Wed, 15 October 2003 11:51 Go to previous message
mvukovic is currently offline  mvukovic
Messages: 63
Registered: July 1998
Member
wmc@bas.ac.uk wrote in message news:<3f8bebd3@news.nwl.ac.uk>...
> I want to know if a given keyword has been passed down via _extra, so
> I said "if (n_elements(e.c_linestyle) ne 0)" which of course doesn't
> work because if it isn't there you can't say e.linestyle (bring on
> perl...). I can use tag names to get all the tags, then search through
> for a match, but that seems silly and ugly. What is the correct way
> to find if a given structure has a certain tag in it? (And why
> couldn't I find the answer buried within DF's site ;-)?
>
> -W.


You may find the following routine usefull. It uses regular
expression matching to check for matches.

You may off course, combine it with some of the type-checking routines
posted on this thread

Mirko

function WhereKwdLike,vsStringVector,sString,cFound,_extra=_extra
; function returns matches of String in String Vector. A match occurs
; when the string, of length N matches the first N characters of a
; vector element. This function mimics the behavior of IDL when it
; matches an incomplete keyword.

;; Use a regular expression match. We match the String vector against
;; the string regular expression. In the regular expression, ^
matches
;; the string beginning and .* will match any number of characters
viMatches=StRegEx(vsStringVector,'^'+sString+'.*',/Fold_Case , $
_extra=_extra)
viFound=where(viMatches eq 0,cFound)
return,viFound
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: What does an optimal scientific programming language/environment need?
Next Topic: efficient polynomial fitting

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:07:48 PDT 2025

Total time taken to generate the page: 0.15746 seconds