This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-31
Channels
- # announcements (2)
- # beginners (208)
- # boot (4)
- # calva (5)
- # cider (3)
- # clojars (3)
- # clojure (59)
- # clojure-dev (27)
- # clojure-india (2)
- # clojure-spec (46)
- # clojure-uk (3)
- # clojuredesign-podcast (4)
- # clojurescript (11)
- # cursive (10)
- # emacs (2)
- # figwheel-main (3)
- # off-topic (73)
- # onyx (1)
- # re-frame (8)
- # reagent (3)
- # rewrite-clj (12)
- # shadow-cljs (29)
- # spacemacs (1)
- # tools-deps (19)
Where can I find an exhaustive list of escape sequences in Clojure string literals? Is this different in ClojureScript?
For example, what does this mean: "\312"
?
\312 is not a thing
oh, in a string that should be unicode
:thinking_face:, But I thought unicode escapes are written this way: "\uXXXX"
, where X
is #"[\da-fA-F]"
I'm honestly not sure what's going on there - you're getting some kind of encoding, but does not seem to be octal or hex
actually, that is octal you're seeing
user=> \o312
\Ê
user=> "\312"
"Ê"
The Clojure cheatsheet might actually be complete here: https://jafingerhut.github.io/cheatsheet/clojuredocs/cheatsheet-tiptip-cdocs-summary.html
In the section "Strings" then "Create"
but "\o312"
doesn't work, which is the weird part?
maybe that's expected
I think that is expected, even if it doesn't make it terribly easy to remember 🙂
Strings use Java syntax, character literals are distinct to Clojure, I think?
I guess the reader page just says "standard java escape characters are supported" and the rest refers to chars
of course, the Java standard has changed since that was written :)
or I should say expanded
Is there a changelog.md for changes to the Java spec? 🙂
yes, per revision
like http://cr.openjdk.java.net/~iris/se/12/spec/fr/java-se-12-fr-spec/java-se-12-annex-3.html
https://docs.oracle.com/javase/specs/jls/se12/html/jls-3.html#jls-3.10.6 is the relevant latest java string escapes
I think that's all the same as forever though and should work in Clojure
I was think of the number format changes (like 1_000)
which has not been added to Clojure (and might even be problematic given our support for _ as a symbol)