name

functionsince v0.0-927 clojure.core/nameEdit
(name x)

Details:

Returns the name string of a possibly namespace-qualified keyword or symbol.

Equivalent to identity for strings.


Examples:

With namespaces:

(name :foo/bar)
;;=> "bar"

(name 'foo/bar)
;;=> "bar"

Without namespaces:

(name :foo)
;;=> "foo"

(name 'foo)
;;=> "foo"

Strings have no concept of a namespace:

(name "foo/bar")
;;=> "foo/bar"

(name "foo")
;;=> "foo"

See Also:


Source docstring:
Returns the name String of a string, symbol or keyword.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn name
  [x]
  (if (implements? INamed x)
    (-name x)
    (if (string? x)
      x
      (throw (js/Error. (str "Doesn't support name: " x))))))