On 29 Mar 2016 at 19:07, Joseph Alotta wrote:

> Greetings,
>
> I want to test a String to see if it can be a Date using mm/dd/yyyy
> format.  I want something that won´t cause a walkback window.  Is
> there a String method isValidAsADate?
>
> Sincerely,
>
> Joe.
>

You might have a method like this:

isDate: aString
        "Answer whether aString is in the form 'mm/dd/yyyy' "
        | w x |
        w := aString asString select: [:a | a isDigit or: a = $/].
        x := w findTokens: '/'.
        ^ x size = 3 and: [w  = aString]


This is the general idea. Let me know if you have any questions.

 - Dan
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to