None of this is working very well; bit it is working a bit.
This commit is contained in:
parent
3551623374
commit
357d4c5853
7 changed files with 2518 additions and 2 deletions
20
resources/cljs/clojure/string.cljs
Normal file
20
resources/cljs/clojure/string.cljs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
(ns clojure.string)
|
||||
|
||||
;; NOTE NOTE NOTE! This is not the real `clojure.string`. It dummies enough
|
||||
;; of `clojure.string` to get other libraries I'm using running!
|
||||
|
||||
(defn escape
|
||||
"Escape characters in `s` which HTML cannot be certain to directly render,
|
||||
using hints from these `char-escapes`, which is expected to map characters
|
||||
to string representations of appropriate HTML entity substutions."
|
||||
[s char-escapes]
|
||||
(apply str (map #(let [c (int %)
|
||||
m (char-escapes %)]
|
||||
(cond m m
|
||||
(<= 32 c 126) %
|
||||
:else (str "&#" c ";"))) s)))
|
||||
|
||||
(defn replace
|
||||
"Replace all occurences of this `pattern` in this string `s` with this `replace`ment."
|
||||
[s pattern replace]
|
||||
(.replaceAll s pattern replace))
|
||||
Loading…
Add table
Add a link
Reference in a new issue