Liking cljdoc? Tell your friends :D

com.wallbrew.spoon.string

Functions for working with strings.

Functions for working with strings.
raw docstring

->slugclj

(->slug s)

Take a string s and return a slug-ified string.

For example:

  (->slug "Nick's recipe" "nicks-recipe")
Take a string `s` and return a [slug-ified](https://en.wikipedia.org/wiki/Clean_URL#Slug) string.

For example:

```clj
  (->slug "Nick's recipe" "nicks-recipe")
```
sourceraw docstring

->spongebob-caseclj/s

(->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"
```
sourceraw docstring

->sporadic-caseclj/s

(->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"
```
sourceraw docstring

cast-to-uppercase?clj/s

An option map key to cast strings to UPPER CASE in prepare-for-compare. Commonly, this is set for the options argument of same? and includes?. This option will be enabled if this key's value is truthy, and is disabled by default.

An option map key to cast strings to UPPER CASE in `prepare-for-compare`.
Commonly, this is set for the `options` argument of `same?` and `includes?`.
This option will be enabled if this key's value is truthy, and is disabled by default.
sourceraw docstring

includes?clj/s

(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
 ```
sourceraw docstring

same-text?clj/s

(same-text? s1 s2)
(same-text? s1 s2 opts)

Checks to see if s1 and s2 are equal after each string has been trimed 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
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close