Characters and character sequences.

Character sequences and strings are immutable but not persistent collections. Strings main purpose is to convey a textual information and not to be a container of characters. Because of this, String is not considered a sequential collection (sequential? predicate) and is not even equal to other persistent collections.

Primary

→str

Available since version 1.0 (view source)

Usage:
  • (->str)

  • (->str a)

  • (->str a b)

  • (->str a b c)

  • (->str a b c d)

  • (->str a b c d & more)

Type signatures:
  • () → String

  • (Any) → String

  • (Any ⨯ Any) → String

  • (Any ⨯ Any ⨯ Any) → String

  • (Any ⨯ Any ⨯ Any ⨯ Any) → String

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ (Va Any)) → String

Returns a string containing given items, if any.

MutableString

Available since version 1.0 (view source)

not referred automatically

TYPE

A type for mutable strings.

See also: String, ICharSequence

String

Available since version 1.0 (view source)

TYPE

A type for strings.

This type is not available in Dunaj lite, please use String+ instead.

String+

Available since version 1.0 (view source)

TYPE

A type for strings.

Identical to String type, meant to be used in Dunaj lite.

blank?

Available since version 1.0 (view source)

Usage:
  • (blank? s)

  • (blank? s wf)

Type signatures:
  • ([]) → Boolean+

  • ([] ⨯ Predicate) → Boolean+

Returns true if s is empty or contains only whitespace characters, otherwise returns false. Optional whitespace function predicate wf can be provided.

canonical

Available since version 1.0 (view source)

Usage:
  • (canonical x)

Type signature:
  • ((U nil ICharSequence ICanonical)) → (Maybe java.lang.String)

Returns canonical string representation of x. Returns x if it is a string or nil.

See also: canonical?, ->str

canonical?

Available since version 1.0 (view source)

Usage:
  • (canonical? x)

Type signature: Predicate

Returns true if object x satisfies ICanonical protocol, false otherwise.

See also: ICanonical, canonical

char-sequence?

Available since version 1.0 (view source)

Usage:
  • (char-sequence? x)

Type signature: Predicate

Returns true if object x satisfies ICharSequence protocol, false otherwise.

empty-string

Available since version 1.0 (view source)

not referred automatically

VAR of type String

An empty string.

See also: ->str, str

index-of

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (index-of coll x)

Type signature:
  • ([] ⨯ (U Char IRed)) → (Maybe Integer+)

Returns first found index of x inside coll, or returns nil if coll does not contain x. x may be a character or a collection.

See also: last-index-of

last-index-of

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (last-index-of coll x)

Type signature:
  • ([] ⨯ (U Char IRed)) → (Maybe Integer+)

Returns last found index of x inside coll, or returns nil if coll does not contain x. x may be a character or a collection.

See also: index-of

provide-char-sequence

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (provide-char-sequence coll)

Type signature:
  • ([]) → ICharSequence

Returns adapted ICharSequence from a given indexed and sectionable coll. Constant time, without data copying.

See also: char-sequence?, ->str, str

str

Available since version 1.0 (view source)

Usage:
  • (str coll)

Type signature:
  • ([]) → String

Returns a string with the contents of coll.

string-factory

Available since version 1.0 (view source)

not referred automatically

VAR of type ICollectionFactory

A string factory.

See also: empty-string, ->str, str

string?

Available since version 1.0 (view source)

Usage:
  • (string? x)

Type signature: Predicate

Returns true if object x is an instance of String type, false otherwise.

Operations

binary

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (binary x)

  • (binary x n)

Type signatures:
  • (Integer+) → java.lang.String

  • (Integer+ ⨯ Integer+) → java.lang.String

Returns a binary string representation of number x padded on n bits, which defaults to 8. Supports up to 64 digits.

See also: hexa

camel-case

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (camel-case string)

Type signature:
  • ([]) → String

Returns a camel case version of a given hyphen cased string.

See also: hyphen-case

capitalize

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (capitalize coll)

Type signature:
  • (IRed) → String

Returns string containing contents from coll with first item in uppercase.

See also: lower-case, upper-case

char→escape-string

Available since version 1.0 (alias of clojure.core/char-escape-string)

not referred automatically

VAR of type {Char String}

Returns escape string for char or nil if none.

See also: char->name-string

char→name-string

Available since version 1.0 (alias of clojure.core/char-name-string)

not referred automatically

VAR of type {Char String}

Returns name string for char or nil if none.

escape

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (escape coll escape-fn)

Type signature:
  • (IRed ⨯ AnyFn) → String

Like clojure.string/escape, but accepts more coll types.

hexa

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (hexa x)

  • (hexa x n)

Type signatures:
  • (Integer+) → java.lang.String

  • (Integer+ ⨯ Integer+) → java.lang.String

Returns a hexadecimal string representation of number x padded on n hexadecimal digits, which defaults to 4. Supports up to 16 digits.

See also: binary

hyphen-case

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (hyphen-case string)

Type signature:
  • ([]) → String

Returns a hyphenated version of a given camel cased string.

See also: camel-case

lower-case

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (lower-case coll)

Type signature:
  • (IRed) → String

Returns string containing lower cased contents from coll.

partition-by

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (partition-by partitionf string)

Type signature:
  • (AnyFn ⨯ String) → IRed

Applies partitionf to each value in string, splitting it each time partitionf returns a new value. Returns a reducible and foldable collection of partitions, which are themselves reducible, foldable and implements ICharSequence.

This version works only on strings.

replace

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (replace coll match replacement)

Type signature:
  • (IRed ⨯ (U Char ICharSequence java.util.regex.Pattern) ⨯ (U Char ICharSequence AnyFn)) → String

Like clojure.string/replace, but accepts more coll types.

See also: replace-first

replace-first

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (replace-first coll match replacement)

Type signature:
  • (IRed ⨯ (U Char ICharSequence java.util.regex.Pattern) ⨯ (U Char ICharSequence AnyFn)) → String

Like clojure.string/replace-first, but accepts more coll types.

See also: replace

split

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (split string)

  • (split whitespace-fn string)

  • (split whitespace-fn keep-whitespace? string)

  • (split whitespace-fn keep-whitespace? shared? string)

Type signatures:
  • (String) → IRed

  • (Predicate ⨯ String) → IRed

  • (Predicate ⨯ Boolean+ ⨯ String) → IRed

  • (Predicate ⨯ Boolean+ ⨯ Boolean+ ⨯ String) → IRed

Returns reducible and foldable collection of splitted strings according to whitespace-fn. Returned collection does not contain empty strings. If keep-whitespace? is true (defaults to false), returned collection will contain 'whitespace chunks'. If shared? is true (defaults to false), returned collection contains custom implementation of ICharSequence which shares data with input string, instead of containing separate String objects.

See also: partition-by

trim

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (trim coll)

Type signature:
  • (IRed) → String

Removes whitespace from both sides of coll.

See also: trimr, triml, trim-newline

trim-newline

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (trim-newline coll)

Type signature:
  • (IRed) → String

Removes all trailing newline (\r or \n) characters from coll.

See also: trim, triml, trimr

triml

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (triml coll)

Type signature:
  • (IRed) → String

Removes whitespace from the left side of coll.

See also: trim, trimr, trim-newline

trimr

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (trimr coll)

Type signature:
  • (IRed) → String

Removes whitespace from the right side of coll.

See also: trim, triml, trim-newline

upper-case

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (upper-case coll)

Type signature:
  • (IRed) → String

Returns string containing upper cased contents from coll.

Other

In this section: get-sbcha sbcha

get-sbcha

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (get-sbcha s)

Type signature:
  • (java.lang.AbstractStringBuilder) → (Array Char)

Returns char array from a mutable string

sbcha

Available since version 1.0 (view source)

not referred automatically

VAR of type java.lang.reflect.Field

Makes internal StringBuilder char array public.