try re with clojure.core/re-matches

On Tue, Mar 13, 2018 at 12:14 PM, Didier <didi...@gmail.com> wrote:

> (defn valid-yyyymmdd?
>   [date]
>   ;; Here's the code that you would use in Java, but using Clojure
> interop, which needs to return true/false if valid.
>   ;; So an example:
>   (try (let [format (java.time.format.DateTimeFormatter/ofPattern
> "yyyyMMdd")]
>          (java.time.LocalDate/parse date format)
>          true)
>        (catch java.time.format.DateTimeParseException e
>          false)))
>
> (s/def ::yyyymmdd valid-yyyymmdd?)
>
> Now ::yyyymmdd is a spec for strings that formats as yyyyMMdd.
>
> On Monday, 12 March 2018 19:04:43 UTC-7, bijay paudel wrote:
>>
>> Any idea how can I use in Clojure spec?
>>
>> Thanks!
>> Bijay
>>
>> On Mon, Mar 12, 2018 at 9:02 PM, Didier <did...@gmail.com> wrote:
>>
>>> Do it as you would in Java, using Clojure/Java interop.
>>>
>>> If you paste the Java code for how you'd do it, we can help you convert
>>> it to Clojure interop code.
>>>
>>>
>>> On Monday, 12 March 2018 15:28:27 UTC-7, pbi...@gmail.com wrote:
>>>>
>>>> I am java certified professional.Currently  I am working  Clojure I am
>>>> still learning clojure.
>>>> I am trying to validate date ( YYYYMMDD) using clojure. Any one have
>>>> idea how can I validate?
>>>>
>>>> Thanks!
>>>> Bijay
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
https://twitter.com/number23_cn

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to