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
[Q] extracting value from a structure ... [message #12793] Thu, 10 September 1998 00:00 Go to previous message
dEdmundson is currently offline  dEdmundson
Messages: 23
Registered: February 1998
Junior Member
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? s is not known at compile time so
the trivial r.age reference is not possible.
My current solution is:

command = 'v=r.'+s
execute(command)
print, 'age=',v

but this is slow because of the run time
compilation of 'command'. Surely there
is an easier way ...

Cheers,
Darran.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
[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: Sun Oct 12 01:03:36 PDT 2025

Total time taken to generate the page: 0.80032 seconds