Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Check if a path exists?

From: jelinem1::nationwide::com at: 21-Mar-2001 8:32

If the path (eg) data/comment exists and it IS set to SOME value, eg an empty string or an empty block, then your first example should have worked: comment: data/comment if (length? comment) > 0 [ some code...] Since it doesn't, then the path could exist yet not set to a value, in which case the following should work: if value? (in data 'comment) [ some code...] Not having used CGI stuff I'm not exactly sure about the nature of your problem, but I suspect that you want to determine whether a word is an element of an object, that is, whether 'comment exists at all in 'data. I use this: if find next first data 'comment [ some code...] Need me to explain it? - Michael Jelinek [stefan--falk--slg--se] on 03/21/2001 04:59:30 AM From: [stefan--falk--slg--se] on 03/21/2001 04:59 AM Please respond to [rebol-list--rebol--com] Sent by: [rebol-bounce--rebol--com] To: [rebol-list--rebol--com] cc: Subject: [REBOL] Check if a path exists? Hi list, how can I check if a path has a value. I've decode some cgi into objects, something like this: data/name data/comment Now, if I want to check if there's actually something in data/comment (as it sometimes isn't), how should do? comment: data/comment if (length? comment) > 0 [ some code...] doesn't work... and if exists? data/comment doesn't work either.. Any tips? /Regards Stefan