Functions for working with strings.
Functions for working with strings.
(->spongebob-case s)
Take a string s
and coerce characters alternatively between lower and upper case.
For example:
(->spongebob-case "spongebob") ;; => "sPoNgEbOb"
Take a string `s` and coerce characters alternatively between lower and upper case. For example: ```clj (->spongebob-case "spongebob") ;; => "sPoNgEbOb" ```
(->sporadic-case s)
Take a string s
and randomly coerce characters to either lower or upper case.
For example:
(->sporadic-case "hello world") ;; => "hElLo wOrLd"
(->sporadic-case "hello world") ;; => "hElLo world"
Take a string `s` and randomly coerce characters to either lower or upper case. For example: ```clj (->sporadic-case "hello world") ;; => "hElLo wOrLd" (->sporadic-case "hello world") ;; => "hElLo world" ```
(includes? s1 s2)
(includes? s1 s2 opts)
Checks to see if s1
includes s2
after each string has been modified by prepare-for-compare
.
An option map may be passed as an optional second argument. The following keys are supported:
:uppercase?
- If true, s1
and s2
will be coerced to upper case. Defaults to false.Example:
(includes? " Hello " "hello") ; => true
(includes? " Hello there " "hello" {:uppercase? true}) ; => true
(includes? " Hello " "goodbye" {:uppercase? false}) ; => false
Checks to see if `s1` includes `s2` after each string has been modified by `prepare-for-compare`. An option map may be passed as an optional second argument. The following keys are supported: - `:uppercase?` - If true, `s1` and `s2` will be coerced to upper case. Defaults to false. Example: ```clj (includes? " Hello " "hello") ; => true (includes? " Hello there " "hello" {:uppercase? true}) ; => true (includes? " Hello " "goodbye" {:uppercase? false}) ; => false ```
(same-text? s1 s2)
(same-text? s1 s2 opts)
Checks to see if s1
and s2
are equal after each string has been trim
ed and cast to the same casing.
An option map may be passed as an optional second argument. The following keys are supported:
:uppercase?
- If true, s1
and s2
will be coerced to upper case. Defaults to false.Example:
(same-text? " Hello " "hello") ; => true
(same-text? " Hello " "hello" {:uppercase? true}) ; => true
(same-text? " Hello " "goodbye" {:uppercase? false}) ; => false
Checks to see if `s1` and `s2` are equal after each string has been `trim`ed and cast to the same casing. An option map may be passed as an optional second argument. The following keys are supported: - `:uppercase?` - If true, `s1` and `s2` will be coerced to upper case. Defaults to false. Example: ```clj (same-text? " Hello " "hello") ; => true (same-text? " Hello " "hello" {:uppercase? true}) ; => true (same-text? " Hello " "goodbye" {:uppercase? false}) ; => false ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close