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

Check if a path exists?

 [1/3] from: stefan:falk:slg:se at: 21-Mar-2001 11:59


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

 [2/3] 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]@rebol.com on 03/21/2001 04:59:30 AM From: [stefan--falk--slg--se]@rebol.com 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

 [3/3] from: stefan:falk:slg:se at: 21-Mar-2001 15:48


Hi, I understand that last line, and I think it might work, because I want to know if there actually is something in /comment, I'll try it immediately, thanks! /Regards Stefan