Back
lower-case (clj)
(source)function
(lower-case s)
Converts string to all lower-case.
Examples
clojure
(ns clojure.test-clojure.string
(:require [clojure.string :as s])
(:use clojure.test))
(deftest t-lower-case
(is (= "foobar" (s/lower-case "FooBar"))))
(deftest nil-handling
(are [f args] (thrown? NullPointerException (apply f args))
s/reverse [nil]
s/replace [nil #"foo" "bar"]
s/replace-first [nil #"foo" "bar"]
s/re-quote-replacement [nil]
s/capitalize [nil]
s/upper-case [nil]
s/lower-case [nil]
s/split [nil #"-"]
s/split [nil #"-" 1]
s/trim [nil]
s/triml [nil]
s/trimr [nil]
s/trim-newline [nil]))
(deftest char-sequence-handling
(are [result f args] (let [[^CharSequence s & more] args]
(= result (apply f (StringBuffer. s) more)))
"paz" s/reverse ["zap"]
"foo:bar" s/replace ["foo-bar" \- \:]
"ABC" s/replace ["abc" #"\w" s/upper-case]
"faa" s/replace ["foo" #"o" (StringBuffer. "a")]
"baz::quux" s/replace-first ["baz--quux" #"--" "::"]
"baz::quux" s/replace-first ["baz--quux" (StringBuffer. "--") (StringBuffer. "::")]
"zim-zam" s/replace-first ["zim zam" #" " (StringBuffer. "-")]
"\\\\ \\$" s/re-quote-replacement ["\\ $"]
"Pow" s/capitalize ["POW"]
"BOOM" s/upper-case ["boom"]
"whimper" s/lower-case ["whimPER"]
["foo" "bar"] s/split ["foo-bar" #"-"]
"calvino" s/trim [" calvino "]
"calvino " s/triml [" calvino "]
" calvino" s/trimr [" calvino "]
"the end" s/trim-newline ["the end\r\n\r\r\n"]
true s/blank? [" "]
["a" "b"] s/split-lines ["a\nb"]
"fa la la" s/escape ["fo lo lo" {\o \a}]))
clojure
(ns clojure.test-clojure.data-structures
(:use clojure.test
[clojure.test.generative :exclude (is)])
(:require [clojure.test-clojure.generators :as cgen]
[clojure.data.generators :as gen]
[clojure.string :as string])
(:import [java.util Collection]))
(defn case-indendent-string-cmp [s1 s2]
(compare (string/lower-case s1) (string/lower-case s2)))
logseq/logseq
(ns frontend.components.journal
(:require [clojure.string :as string]
[frontend.components.page :as page]
[frontend.components.reference :as reference]
[frontend.components.scheduled-deadlines :as scheduled]
[frontend.date :as date]
[frontend.db :as db]
[frontend.db-mixins :as db-mixins]
[frontend.db.model :as model]
[frontend.handler.page :as page-handler]
[frontend.state :as state]
[logseq.graph-parser.util :as gp-util]
[frontend.ui :as ui]
[frontend.util :as util]
[frontend.util.text :as text-util]
[goog.object :as gobj]
[reitit.frontend.easy :as rfe]
[rum.core :as rum]))
(rum/defc journal-cp < rum/reactive
[title]
(let [;; Don't edit the journal title
page (string/lower-case title)
repo (state/sub :git/current-repo)
today? (= (string/lower-case title)
(string/lower-case (date/journal-name)))
page-entity (db/pull [:block/name (util/page-name-sanity-lc title)])
data-page-tags (when (seq (:block/tags page-entity))
(let [page-names (model/get-page-names-by-ids (map :db/id (:block/tags page)))]
(text-util/build-data-value page-names)))]
[:div.flex-1.journal.page (cond-> {}
data-page-tags
(assoc :data-page-tags data-page-tags))
nextjournal/clerk
;; # 🕳 Deep Data
^{:nextjournal.clerk/visibility {:code :hide}}
(ns ^:nextjournal.clerk/no-cache deep
(:require [clojure.string :as str]
[hickory.core :as hick]
[nextjournal.clerk :as clerk]
[nextjournal.clerk.viewer :as viewer]))
(def letters->words
(->> "/usr/share/dict/words"
slurp
str/split-lines
(group-by (comp keyword str/lower-case first))
(into (sorted-map))))
nrepl/nrepl
(ns nrepl.spec
"This serves as a reference for messages as implemented by the default nREPL
middleware. This is not a formal specification."
(:require [clojure.spec.alpha :as s]
[clojure.string :as str]))
(s/def ::uuid-str #(and (string? %)
(re-matches #"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
(str/lower-case %))))
day8/re-frame-10x
(ns day8.re-frame-10x.panels.traces.events
(:require
[clojure.set :as set]
[clojure.string :as string]
[day8.re-frame-10x.inlined-deps.re-frame.v1v3v0.re-frame.core :as rf]
[day8.re-frame-10x.fx.local-storage :as local-storage]))
(rf/reg-event-db
::add-query
[(rf/path [:traces :queries]) rf/unwrap (local-storage/save "filter-items")]
(fn [filters {:keys [query type]}]
(if (some #(= query (:query %)) filters)
filters
(let [filters (if (= :slower-than type)
(remove #(= :slower-than (:type %)) filters)
filters)]
(conj filters
{:id (random-uuid)
:query (if (or (= type :contains) (= type :contains-not))
(string/lower-case query)
(js/parseFloat query))
:type type})))))
PrecursorApp/precursor
(ns pc.http.routes.api
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clojure.core.memoize :as memo]
[clojure.string :as str]
[clojure.tools.reader.edn :as edn]
[crypto.equality :as crypto]
[defpage.core :as defpage :refer (defpage)]
[pc.auth :as auth]
[pc.crm :as crm]
[pc.datomic :as pcd]
[pc.early-access]
[pc.http.doc :as doc-http]
[pc.http.team :as team-http]
[pc.http.handlers.custom-domain :as custom-domain]
[pc.models.chat-bot :as chat-bot-model]
[pc.models.doc :as doc-model]
[pc.models.flag :as flag-model]
[pc.models.team :as team-model]
[pc.profile :as profile]
[ring.middleware.anti-forgery :as csrf]
[slingshot.slingshot :refer (try+ throw+)]))
(defpage create-team [:post "/api/v1/create-team"] [req]
(let [params (some-> req :body slurp edn/read-string)
subdomain (some-> params :subdomain str/lower-case str/trim)
coupon-code (some-> params :coupon-code)
cust (get-in req [:auth :cust])]
(cond (empty? cust)
{:status 400 :body (pr-str {:error :not-logged-in
:msg "You must log in first."})}