On Fri, Feb 1, 2013 at 7:05 AM, Staffan Tylen <staffan.tylen@gmail.com> wrote:
 
Similar problem to a previous posting of mine, does anybody have a 'good' way to validate if a string is a valid date or time? I've tried with the .DateTime class but it gives a syntax conditions if the input is wrong. If nothing else I will need to use to signal on I guess.

I don't have any clever method here.  Some of the old-time Rexx users probably do.  I was hoping that more ooRexx users would participate on this list.

I would bet that Chip might have a good method here.

However, based on your 'similar problem' language, what might be a good idea for you is to write a utility class.  Maybe call it Validater and add some validate methods to it.  You could use signal on in the methods to trap errors and return true if there is no trap and false if not.

::class Valdater public

::method validFile
    use strict arg fileName
    ...

::method validDate
    use strict arg date
 
    ...


The implementation of the methods would not necessarily be clever, just correct.  Then you wouldn't need to look at the. perhaps ugly, implementation code, just use the class.

--
Mark Miesfeld