Skip to content

Commit b275055

Browse files
committed
read-string returns nil when string is nil or empty
1 parent 5cf6aa3 commit b275055

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/clj/clojure/core.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3430,10 +3430,12 @@
34303430
vars, namespaces are allowed, as well as static methods and
34313431
constructors of derivees of the *read-whitelist*
34323432
3433+
Returns nil when string is nil or empty.
3434+
34333435
See also - safe-read-string"
34343436
{:added "1.0"
34353437
:static true}
3436-
[s] (clojure.lang.RT/readString s))
3438+
[^String s] (when (pos? (count s)) (clojure.lang.RT/readString s)))
34373439

34383440
(defn safe-read-string
34393441
"Same as read-string, with *read-eval* bound to false"

0 commit comments

Comments
 (0)