uuid

functionsince v0.0-3291Edit
(uuid s)

Details:

Creates a universally unique identifier (UUID) from the given string, using the UUID type.

The string has an expected format 8-4-4-4-12 where the numbers represent the number of hex digits. No validation is performed.

To create a UUID literal (parsed and validated at compile time), use #uuid literal.


Examples:

(uuid "00000000-0000-0000-0000-000000000000")
;;=> #uuid "00000000-0000-0000-0000-000000000000"

(uuid "97bda55b-6175-4c39-9e04-7c0205c709dc")
;;=> #uuid "97bda55b-6175-4c39-9e04-7c0205c709dc"

No validation is performed:

(uuid "")
;;=> #uuid ""

See Also:


Source docstring:
Returns a UUID consistent with the string s.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn uuid
  [s]
  (assert (string? s))
  (UUID. (.toLowerCase s) nil))