Liking cljdoc? Tell your friends :D

cuerdas.core


<<clj/smacrodeprecated

(<< & strings)

A backward compatibility alias for istr macro.

A backward compatibility alias for `istr` macro.
sourceraw docstring

<<-clj/s

(<<- s)
(<<- r s)

Unindent multiline text. Uses either a supplied regex or the shortest beginning-of-line to non-whitespace distance

Unindent multiline text.
Uses either a supplied regex or the shortest
beginning-of-line to non-whitespace distance
sourceraw docstring

alnum?clj/s

(alnum? s)

Checks if a string contains only alphanumeric characters.

Checks if a string contains only alphanumeric characters.
sourceraw docstring

alpha-numeric?clj/sdeprecated

source

alpha?clj/s

(alpha? s)

Checks if a string contains only alpha characters.

Checks if a string contains only alpha characters.
sourceraw docstring

blank?clj/s

(blank? s)

Checks if a string is empty or contains only whitespace.

Checks if a string is empty or contains only whitespace.
sourceraw docstring

camelclj/s

(camel s)

Output will be: lowerUpperUpperNoSpaces accepts strings and keywords

Output will be: lowerUpperUpperNoSpaces
accepts strings and keywords
sourceraw docstring

capitalclj/s

(capital s)

Uppercases the first character of a string or keyword

Uppercases the first character of a string or keyword
sourceraw docstring

capitalizeclj/sdeprecated

source

caseless=clj/s

(caseless= s1 s2)

Compare strings in a case-insensitive manner.

This function is locale independent.

Compare strings in a case-insensitive manner.

This function is locale independent.
sourceraw docstring

charsclj/s

(chars s)

Split a string in a seq of chars.

Split a string in a seq of chars.
sourceraw docstring

classifyclj/sdeprecated

source

cleanclj/s

(clean s)

Trim and replace multiple spaces with a single space.

Trim and replace multiple spaces with
a single space.
sourceraw docstring

collapse-whitespaceclj/s

(collapse-whitespace s)

Converts all adjacent whitespace characters to a single space.

Converts all adjacent whitespace characters
to a single space.
sourceraw docstring

contains?clj/sdeprecated

source

css-selectorclj/s

(css-selector s)

Output will be either: (js-selector "LeadingDash") ;; => -leading-dash (js-selector "noLeadingDash") ;; => no-leading-dash

accepts keywords and strings, with any standard delimiter

Output will be either:
   (js-selector "LeadingDash") ;; => -leading-dash
   (js-selector "noLeadingDash") ;; => no-leading-dash

accepts keywords and strings, with any standard delimiter
sourceraw docstring

dasherizeclj/sdeprecated

source

digits?clj/s

(digits? s)

Checks if a string contains only digit characters.

Checks if a string contains only digit characters.
sourceraw docstring

empty-or-nil?clj/s

(empty-or-nil? s)

Convenient helper for check emptines or if value is nil.

Convenient helper for check emptines or if value is nil.
sourceraw docstring

empty?clj/s

(empty? s)

Checks if a string is empty.

Checks if a string is empty.
sourceraw docstring

ends-with?clj/s

(ends-with? s suffix)

Check if the string ends with suffix.

Check if the string ends with suffix.
sourceraw docstring

endswith?clj/sdeprecated

source

escape-htmlclj/s

(escape-html s)
source

fmtclj/s

A shorter alias to format function.

A shorter alias to `format` function.
sourceraw docstring

formatclj/s

(format s & more)

Simple string interpolation.

Simple string interpolation.
sourceraw docstring

humanclj/s

(human s)

Output will be: lower cased and space separated accepts strings and keywords

Output will be: lower cased and space separated
accepts strings and keywords
sourceraw docstring

humanizeclj/sdeprecated

source

includes?clj/s

(includes? s subs)

Determines whether a string contains a substring.

Determines whether a string contains a substring.
sourceraw docstring

istrclj/smacro

(istr & strings)

Accepts one or more strings; emits a str invocation that concatenates the string data and evaluated expressions contained within that argument. Evaluation is controlled using ~{} and ~() forms. The former is used for simple value replacement using clojure.core/str; the latter can be used to embed the results of arbitrary function invocation into the produced string.

Examples:

user=> (def v 30.5)
#'user/v
user=> (istr "This trial required ~{v}ml of solution.")
"This trial required 30.5ml of solution."
user=> (istr "There are ~(int v) days in November.")
"There are 30 days in November."
user=> (def m {:a [1 2 3]})
#'user/m
user=> (istr "The total for your order is $~(->> m :a (apply +)).")
"The total for your order is $6."
user=> (<< "Just split a long interpolated string up into ~(-> m :a (get 0)), "
         "~(-> m :a (get 1)), or even ~(-> m :a (get 2)) separate strings "
         "if you don't want a << expression to end up being e.g. ~(* 4 (int v)) "
         "columns wide.")
"Just split a long interpolated string up into 1, 2, or even 3 separate strings if you don't want a << expression to end up being e.g. 120 columns wide."

Note that quotes surrounding string literals within ~() forms must be escaped.

Accepts one or more strings; emits a `str` invocation that
concatenates the string data and evaluated expressions contained
within that argument.  Evaluation is controlled using ~{} and ~()
forms. The former is used for simple value replacement using
clojure.core/str; the latter can be used to embed the results of
arbitrary function invocation into the produced string.

Examples:

    user=> (def v 30.5)
    #'user/v
    user=> (istr "This trial required ~{v}ml of solution.")
    "This trial required 30.5ml of solution."
    user=> (istr "There are ~(int v) days in November.")
    "There are 30 days in November."
    user=> (def m {:a [1 2 3]})
    #'user/m
    user=> (istr "The total for your order is $~(->> m :a (apply +)).")
    "The total for your order is $6."
    user=> (<< "Just split a long interpolated string up into ~(-> m :a (get 0)), "
             "~(-> m :a (get 1)), or even ~(-> m :a (get 2)) separate strings "
             "if you don't want a << expression to end up being e.g. ~(* 4 (int v)) "
             "columns wide.")
    "Just split a long interpolated string up into 1, 2, or even 3 separate strings if you don't want a << expression to end up being e.g. 120 columns wide."

Note that quotes surrounding string literals within ~() forms must be
escaped.
sourceraw docstring

joinclj/s

(join coll)
(join separator coll)

Joins strings together with given separator.

Joins strings together with given separator.
sourceraw docstring

js-selectorclj/s

(js-selector s)

Output will be either: (js-selector "-pascal-case-me") ;; => PascalCaseMe (js-selector "camel-case-me") ;; => camelCaseMe

accepts keywords and strings, with any standard delimiter

Output will be either:
   (js-selector "-pascal-case-me") ;; => PascalCaseMe
   (js-selector "camel-case-me") ;; => camelCaseMe

accepts keywords and strings, with any standard delimiter
sourceraw docstring

kebabclj/s

(kebab s)

Output will be: lower-cased-and-separated-with-dashes accepts strings and keywords

Output will be: lower-cased-and-separated-with-dashes
accepts strings and keywords
sourceraw docstring

keywordclj/s

(keyword k)
(keyword n k)

Safer version of clojure keyword, accepting a symbol for the namespace and kebab-casing the key

Safer version of clojure keyword, accepting a
symbol for the namespace and kebab-casing the key
sourceraw docstring

letters?clj/s

(letters? s)

Checks if string contains only letters. This function will use all the unicode range.

Checks if string contains only letters.
This function will use all the unicode range.
sourceraw docstring

linesclj/s

(lines s)

Return a list of the lines in the string.

Return a list of the lines in the string.
sourceraw docstring

locale-caseless=clj/s≠

clj
(locale-caseless= s1 s2)
(locale-caseless= s1 s2 locale)
cljs
(locale-caseless= s1 s2)

Compare strings in a case-insensitive manner respecting the current locale.

An optional locale can be passed as third argument (only on JVM).

Compare strings in a case-insensitive manner
respecting the current locale.

An optional locale can be passed as third
argument (only on JVM).
sourceraw docstring

locale-lowerclj/s≠

clj
(locale-lower s)
(locale-lower s locale)
cljs
(locale-lower s)

Converts string to all lower-case respecting the current system locale.

In the jvm you can provide a concrete locale to use as the second optional argument.

Converts string to all lower-case respecting
the current system locale.

In the jvm you can provide a concrete locale to
use as the second optional argument.
sourceraw docstring

locale-upperclj/s≠

clj
(locale-upper s)
(locale-upper s locale)
cljs
(locale-upper s)

Converts string to all upper-case respecting the current system locale.

In the jvm you can provide a concrete locale to use as the second optional argument.

Converts string to all upper-case respecting
the current system locale.

In the jvm you can provide a concrete locale to
use as the second optional argument.
sourceraw docstring

lowerclj/s

(lower s)

Converts string to all lower-case.

This function works in strictly locale independent way, if you want a localized version, just use locale-lower

Converts string to all lower-case.

This function works in strictly locale independent way,
if you want a localized version, just use `locale-lower`
sourceraw docstring

lstripclj/s

source

ltrimclj/s

(ltrim s)
(ltrim s chs)

Removes whitespace or specified characters from left side of string.

Removes whitespace or specified characters
from left side of string.
sourceraw docstring

numeric?clj/s

(numeric? s)

Check if a string contains only numeric values.

Check if a string contains only numeric values.
sourceraw docstring

one-of?clj/s

(one-of? coll s)

Returns true if s can be found in coll.

Returns true if s can be found in coll.
sourceraw docstring

padclj/s

(pad s & [{:keys [length padding type] :or {length 0 padding " " type :left}}])

Pads the str with characters until the total string length is equal to the passed length parameter. By default, pads on the left with the space char.

Pads the str with characters until the total string
length is equal to the passed length parameter. By
default, pads on the left with the space char.
sourceraw docstring

parse-doubleclj/s

(parse-double s)

Return the double value from string.

Return the double value from string.
sourceraw docstring

parse-floatclj/sdeprecated

source

parse-intclj/s

(parse-int s)

Return the number value in integer form.

Return the number value in integer form.
sourceraw docstring

parse-longclj/sdeprecated

source

parse-numberclj/s

(parse-number s)

General purpose function for parse number like string to number. It works with both integers and floats.

General purpose function for parse number like
string to number. It works with both integers
and floats.
sourceraw docstring

pascalclj/s

(pascal s)

Output will be: CapitalizedAndTouchingTheNext accepts strings and keywords

Output will be: CapitalizedAndTouchingTheNext
accepts strings and keywords
sourceraw docstring

phraseclj/s

(phrase s)

Output will be: Space separated with the first letter capitalized. accepts strings and keywords

Output will be: Space separated with the first letter capitalized.
accepts strings and keywords
sourceraw docstring

pruneclj/s

(prune s num)
(prune s num subs)

Truncates a string to a certain length and adds '...' if necessary.

Truncates a string to a certain length and adds '...'
if necessary.
sourceraw docstring

quoteclj/s

(quote s)
(quote s qchar)

Quotes a string.

Quotes a string.
sourceraw docstring

repeatclj/s

(repeat s)
(repeat s n)

Repeats string n times.

Repeats string n times.
sourceraw docstring

replaceclj/s

(replace s match replacement)

Replaces all instance of match with replacement in s.

The replacement is literal (i.e. none of its characters are treated specially) for all cases above except pattern / string.

In match is pattern instance, replacement can contain $1, $2, etc. will be substituted with string that matcher the corresponding parenthesized group in pattern.

If you wish your replacement string to be used literary, use (cuerdas.regexp/escape replacement).

Example: (replace "Almost Pig Latin" #"\b(\w)(\w+)\b" "$2$1ay") ;; => "lmostAay igPay atinLay"

Replaces all instance of match with replacement in s.

The replacement is literal (i.e. none of its characters are treated
specially) for all cases above except pattern / string.

In match is pattern instance, replacement can contain $1, $2, etc.
will be substituted with string that matcher the corresponding
parenthesized group in pattern.

If you wish your replacement string to be used literary,
use `(cuerdas.regexp/escape replacement)`.

Example:
  (replace "Almost Pig Latin" #"\b(\w)(\w+)\b" "$2$1ay")
  ;; => "lmostAay igPay atinLay"
sourceraw docstring

replace-firstclj/s

(replace-first s match replacement)

Replaces first instance of match with replacement in s.

Replaces first instance of match with replacement in s.
sourceraw docstring

reverseclj/s

(reverse s)

Return string reversed.

Return string reversed.
sourceraw docstring

rstripclj/s

source

rtrimclj/s

(rtrim s)
(rtrim s chs)

Removes whitespace or specified characters from right side of string.

Removes whitespace or specified characters
from right side of string.
sourceraw docstring

sliceclj/s

(slice s begin)
(slice s begin end)

Extracts a section of a string and returns a new string.

Extracts a section of a string and returns a new string.
source (clj)source (cljs)raw docstring

slugclj/s

(slug s)

Transform text into a URL slug.

Transform text into a URL slug.
sourceraw docstring

slugifyclj/sdeprecated

source

snakeclj/s

(snake s)

Output will be: lower_cased_and_underscore_separated accepts strings and keywords

Output will be: lower_cased_and_underscore_separated
accepts strings and keywords
sourceraw docstring

splitclj/s

(split s)
(split s sep)
(split s sep num)

Splits a string on a separator a limited number of times. The separator can be a string, character or Pattern (clj) / RegExp (cljs) instance.

Splits a string on a separator a limited
number of times. The separator can be a string,
character or Pattern (clj) / RegExp (cljs) instance.
sourceraw docstring

starts-with?clj/s

(starts-with? s prefix)

Check if the string starts with prefix.

Check if the string starts with prefix.
sourceraw docstring

startswith?clj/sdeprecated

source

stripclj/s

source

strip-newlinesclj/s

(strip-newlines s)

Takes a string and replaces newlines with a space. Multiple lines are replaced with a single space.

Takes a string and replaces newlines with a space.
Multiple lines are replaced with a single space.
sourceraw docstring

strip-prefixclj/s

(strip-prefix s prefix)

Strip prefix in more efficient way.

Strip prefix in more efficient way.
sourceraw docstring

strip-suffixclj/s

(strip-suffix s suffix)

Strip suffix in more efficient way.

Strip suffix in more efficient way.
sourceraw docstring

strip-tagsclj/s

(strip-tags s)
(strip-tags s tags)
(strip-tags s tags mapping)

Remove html tags from string.

Remove html tags from string.
sourceraw docstring

stylizeclj/s

(stylize s every-fn join-with)
(stylize s first-fn rest-fn join-with)
source

substr-betweenclj/s

(substr-between s prefix suffix)

Find string that is nested in between two strings. Return first match

Find string that is nested in between two strings. Return first match
sourceraw docstring

surroundclj/s

(surround s wrap)

Surround a string with another string or character.

Surround a string with another string or character.
sourceraw docstring

titleclj/s

(title s)

Output will be: Each Word Capitalized And Separated With Spaces accepts strings and keywords

Output will be: Each Word Capitalized And Separated With Spaces
accepts strings and keywords
sourceraw docstring

titleizeclj/sdeprecated

source

to-boolclj/s

(to-bool s)

Returns true for 1/on/true/yes string values (case-insensitive), false otherwise.

Returns true for 1/on/true/yes string values (case-insensitive),
false otherwise.
sourceraw docstring

trimclj/s

(trim s)
(trim s chs)

Removes whitespace or specified characters from both ends of string.

Removes whitespace or specified characters
from both ends of string.
sourceraw docstring

underscoreclj/sdeprecated

source

underscoredclj/sdeprecated

source

unescape-htmlclj/s

(unescape-html s)

Converts entity characters to HTML equivalents.

Converts entity characters to HTML equivalents.
sourceraw docstring

unlinesclj/s

(unlines s)

Returns a new string joining a list of strings with a newline char (\n).

Returns a new string joining a list of strings with a newline char (\n).
sourceraw docstring

unquoteclj/s

(unquote s)
(unquote s qchar)

Unquote a string.

Unquote a string.
sourceraw docstring

unsurroundclj/s

(unsurround s surrounding)

Unsurround a string surrounded by another string or character.

Unsurround a string surrounded by another string or character.
sourceraw docstring

upperclj/s

(upper s)

Converts string to all upper-case.

This function works in strictly locale independent way, if you want a localized version, just use locale-upper

Converts string to all upper-case.

This function works in strictly locale independent way,
if you want a localized version, just use `locale-upper`
sourceraw docstring

uslugclj/s

(uslug s)

Unicode friendly version of slug function.

Unicode friendly version of `slug` function.
sourceraw docstring

word?clj/s

(word? s)

Checks if a string contains only the word characters. This function will use all the unicode range.

Checks if a string contains only the word characters.
This function will use all the unicode range.
sourceraw docstring

wordsclj/s

(words s)
(words s re)

Returns a vector of the words in the string.

Returns a vector of the words in the string.
sourceraw docstring

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

× close