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

Home » Public Forums » archive » [Q] extracting value from a structure ...
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: [Q] extracting value from a structure ... [message #12794 is a reply to message #12793] Wed, 09 September 1998 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Darran Edmundson (dEdmundson@Bigfoot.com) writes:

> Consider the following:
>
> r = {name: 'john', age=18}
> s = 'age'
>
> Given the string s, is there an easy way to
> extract the value of the corresponding tag
> in r?

I would try something like this:

r = {name: 'john', age:18}
s = 'age'
index = Where(Tag_Names(r) EQ StrUpCase(s), count)
IF count NE 0 THEN Print, r.(index[0])

Cheers,

David
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: xwindows colour issues
Next Topic: call_external won't release dll

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

Current Time: Tue Dec 02 10:05:25 PST 2025

Total time taken to generate the page: 1.12557 seconds