1.3.0 permalink Arrow_down_16x16
  • (as-url x)
Coerce argument to a URL.

1 Example top

  • (use '[clojure.java.io :only (as-url)])
    (import 'java.io.File)
    user=> (as-url nil)
    user=> (as-url (File. "/tmp"))
    #<URL file:/tmp/>
    user=> (as-url "http://clojuredocs.org")
    #<URL http://clojuredocs.org>
    user=> (as-url "http://clojuredocs.org:8080")
    #<URL http://clojuredocs.org:8080>
    user=> (as-url "clojuredocs.org")
    #<CompilerException java.net.MalformedURLException: no protocol: clojuredocs.org>
Log in to add / edit an example.

See Also top

Log in to add a see also.

Comments top

No comments for as-url. Log in to add a comment.