std.string
blank?
added in 3.0
(blank? s)checks if string is empty or nil
(blank? nil) => true
(blank? "") => true
camel-case
added in 3.0
(camel-case value)converts a string-like object to camel case representation
(camel-case “hello-world”) => “helloWorld”
((wrap camel-case) ’hello_world) => ’helloWorld
capital-case
added in 3.0
(capital-case s)converts a string object to capital case
(capital-case “hello.World”) => “Hello.world”
((wrap capital-case) ’hello.World) => ’Hello.world
capital-sep-case
added in 3.0
(capital-sep-case value)converts a string-like object to captital case representation
(capital-sep-case “hello world”) => “Hello World”
(str ((wrap capital-sep-case) :hello-world)) => “:Hello World”
capitalize
added in 4.0
(capitalize s)capitalize the first letter
(capitalize “hello”) => “Hello”
caseless=
added in 3.0
(caseless= x y)compares two values ignoring case
(caseless= “heLLo” “HellO”) => true
((wrap caseless=) ’heLLo :HellO) => true
decapitalize
added in 4.0
(decapitalize s)lowercase the first letter
(decapitalize “HELLO”) => “hELLO”
dot-case
added in 3.0
(dot-case value)creates a dot-case representation
(dot-case “hello-world”) => “hello.world”
((wrap dot-case) ’helloWorld) => ’hello.world
ends-with?
added in 3.0
(ends-with? s substr)checks if string ends with another
(ends-with? “hello” “lo”) => true
((wrap ends-with?) ’hello ’lo) => true
escape-dollars
added in 3.0
(escape-dollars s)for regex purposes, escape dollar signs in strings
(escape-dollars “$”) => string?
escape-escapes
added in 3.0
(escape-escapes s)makes sure that newlines are printable
(escape-escapes "
") => "\ "
escape-newlines
added in 3.0
(escape-newlines s)makes sure that newlines are printable
(escape-newlines "
") => "
"
escape-quotes
added in 3.0
(escape-quotes s)makes sure that quotes are printable in string form
(escape-quotes “"hello"”) => “\“hello\””
filter-empty-lines
added in 3.0
(filter-empty-lines s)filter empty line
(filter-empty-lines (common/join “\n” [“a” " " " " “b”])) => “a\nb”
from-string
added in 3.0
(from-string string type)(from-string string type opts)converts a string to an object
(from-string “a” clojure.lang.Symbol) => ’a
(from-string “std.string” clojure.lang.Namespace) => (find-ns ’std.string)
has-quotes?
added in 3.0
(has-quotes? s)checks if a string has quotes
(has-quotes? “"hello"”) => true
includes?
added in 3.0
(includes? s substr)checks if first string contains the second
(includes? “hello” “ell”) => true
((wrap includes?) ’hello ’ell) => true
indent
added in 4.0
(indent block n & [{:keys [custom], :or {custom ""}}])indents a block of string
(indent (write-lines “a” “b” “c”) 2) => “a\n b\n c”
indent-rest
added in 4.0
(indent-rest block n & [{:keys [custom], :or {custom ""}}])indents the rest of the boiy
(indent-rest (write-lines “a” “b” “c”) 2) => “a\n b\n c”
join
added in 3.0
(join coll)(join seperator coll)join-lines
added in 4.0
(join-lines arr)join non empty elements in array
(join-lines "" “hello” “world”) => “helloworld”
joinl
added in 3.0
(joinl coll)(joinl coll separator)joins an array using a separator
(joinl “a” “b” “c” “.”) => “a.b.c”
(joinl “a” “b” “c”) => “abc”
((wrap joinl) :a :b :c “-”) => :a-b-c
layout-lines
added in 4.0
(layout-lines tokens)(layout-lines tokens max)layout tokens in lines depending on max length
(layout-lines “hello” “world” “again” “a” “b” 8) => “hello\nworld\nagain a\nb”
lines
added in 3.0
(lines s)transforms string to seperated newlines
(lines “abc\ndef”) => ’(std.string.prose/| “abc” “def”)
lower-case
added in 3.0
(lower-case s)converts a string object to lower case
(lower-case “Hello.World”) => “hello.world”
((wrap lower-case) ’Hello.World) => ’hello.world
lower-sep-case
added in 3.0
(lower-sep-case value)converts a string-like object to a lower case representation
(lower-sep-case “helloWorld”) => “hello world”
((wrap lower-sep-case) ’hello-world) => (symbol “hello world”)
pascal-case
added in 3.0
(pascal-case value)converts a string-like object to a pascal case representation
(pascal-case “helloWorld”) => “HelloWorld”
((wrap pascal-case) :hello-world) => :HelloWorld
path-count
added in 3.0
(path-count s)(path-count s sep)counts the number of elements in a given path
(path/path-count “a/b/c”) => 3
((wrap path/path-count) ns) => 3
path-join
added in 3.0
(path-join arr)(path-join arr sep)joins a sequence of elements into a path separated value
(path/path-join “a” “b” “c”) => “a/b/c”
((wrap path/path-join) ’:a :b :c “-”) => :a-b-c
((wrap path/path-join) ’a b c ’-) => ’a-b-c
path-ns
added in 3.0
(path-ns s)(path-ns s sep)returns the path namespace of the string
(path/path-ns “a/b/c/d”) => “a/b/c”
((wrap path/path-ns) :a.b.c “.”) => :a.b
path-ns-array
added in 3.0
(path-ns-array s)(path-ns-array s sep)returns the path vector of the string
(path/path-ns-array “a/b/c/d”) => “a” “b” “c”
((wrap path/path-ns-array) (keyword “a/b/c/d”)) => :a :b :c
path-nth
added in 3.0
(path-nth s n)(path-nth s n sep)check for the val of the string
(path/path-nth “a/b/c/d” 2) => “c”
path-root
added in 3.0
(path-root s)(path-root s sep)returns the path root of the string
(path/path-root “a/b/c/d”) => “a”
((wrap path/path-root) ’a.b.c “.”) => ’a
path-separator
added in 3.0
(path-separator type)returns the default path separator for an object
(path-separator clojure.lang.Namespace) => “.”
(path-separator clojure.lang.Keyword) => “/”
path-split
added in 3.0
(path-split s)(path-split s sep)splits a sequence of elements into a path separated value
(path/path-split “a/b/c/d”) => ’“a” “b” “c” “d”
(path/path-split “a.b.c.d” “.”) => “a” “b” “c” “d”
((wrap path/path-split) :hello/world) => :hello :world
((wrap path/path-split) :hello.world “.”) => :hello :world
path-stem
added in 3.0
(path-stem s)(path-stem s sep)returns the path stem of the string
(path/path-stem “a/b/c/d”) => “b/c/d”
((wrap path/path-stem) ’a.b.c.d “.”) => ’b.c.d
path-stem-array
added in 3.0
(path-stem-array s)(path-stem-array s sep)returns the path stem vector of the string
(path/path-stem-array “a/b/c/d”) => “b” “c” “d”
((wrap path/path-stem-array) ’a.b.c.d “.”) => ’b c d
path-sub
added in 3.0
(path-sub s start num)(path-sub s start num sep)returns a subsection of the path within the string
(path/path-sub “a/b/c/d” 1 2) => “b/c”
((wrap path/path-sub) (symbol “a/b/c/d”) 1 2) => ’b/c
path-sub-array
added in 3.0
(path-sub-array s start num)(path-sub-array s start num sep)path-val
added in 3.0
(path-val s)(path-val s sep)returns the val of the string
(path/path-val “a/b/c/d”) => “d”
((wrap path/path-val) ’a.b.c.d “.”) => ’d
phrase-case
added in 3.0
(phrase-case value)converts a string-like object to snake case representation
(phrase-case “hello-world”) => “Hello world”
replace
added in 3.0
(replace s match replacement)replace value in string with another
(replace “hello” “el” “AL”) => “hALlo”
((wrap replace) :hello “el” “AL”) => :hALlo
replace-all
added in 4.0
(replace-all s match re)shortcut for .replaceAll
(replace-all “hello” “l” “o”) => “heooo”
reverse
added in 3.0
(reverse s)reverses the string
(reverse “hello”) => “olleh”
((wrap reverse) :hello) => :olleh
snake-case
added in 3.0
(snake-case value)converts a string-like object to snake case representation
(snake-case “hello-world”) => “hello_world”
((wrap snake-case) ’helloWorld) => ’hello_world
spear-case
added in 3.0
(spear-case value)converts a string-like object to spear case representation
(spear-case “hello_world”) => “hello-world”
((wrap spear-case) ’helloWorld) => ’hello-world
split
added in 3.0
(split s re)splits the string into tokens
(split “a b c” #" ") => “a” “b” “c”
((wrap split) :a.b.c (re-pattern “.”)) => :a :b :c
split-lines
added in 3.0
(split-lines s)splits the string into separate lines
(split-lines “a\nb\nc”) => “a” “b” “c”
starts-with?
added in 3.0
(starts-with? s substr)checks if string starts with another
(starts-with? “hello” “hel”) => true
((wrap starts-with?) ’hello ’hel) => true
str:compare
added in 3.0
(str:compare f)wraps a function so that it can compare any two string-like inputs
((str:compare =) :hello ’hello) => true
str:op
added in 3.0
(str:op f)(str:op f return)wraps a string function such that it can take any string-like input
((str:op str false) :hello ’hello) => :hellohello
((str:op str true) :hello ’hello) => “hellohello”
strip-quotes
added in 3.0
(strip-quotes s)gets rid of quotes in a string
(strip-quotes “"hello"”) => “hello”
to-string
added in 3.0
(to-string string)converts an object to a string
(to-string :hello/world) => “hello/world”
(to-string ns) => “std.string.coerce-test”
trim-left
added in 3.0
(trim-left s)trims the string of whitespace on left
(trim-left " hello ") => "hello "
trim-newlines
added in 3.0
(trim-newlines s)removes newlines from right
(trim-newlines “\n\n hello \n\n”) => "\n\n hello "
trim-right
added in 3.0
(trim-right s)trims the string of whitespace on right
(trim-right " hello ") => “hello”
truncate
added in 3.0
(truncate s limit)truncates a word
(truncate “hello there” 5) => “hello”
typeless=
added in 3.0
(typeless= x y)compares two representations
(typeless= “helloWorld” “hello_world”) => true
((wrap typeless=) :a-b-c “a b c”) => true
((wrap typeless=) ’getMethod :get-method) => true
upper-camel-case
added in 4.0
(upper-camel-case value)convert string to uppercase camel
(upper-camel-case “hello-world”) => “HelloWorld”
upper-case
added in 3.0
(upper-case s)converts a string object to upper case
(upper-case “hello-world”) => “HELLO-WORLD”
((wrap upper-case) :hello-world) => :HELLO-WORLD
upper-sep-case
added in 3.0
(upper-sep-case value)converts a string-like object to upper case representation
(upper-sep-case “hello world”) => “HELLO WORLD”
(str ((wrap upper-sep-case) ’hello-world)) => “HELLO WORLD”
whitespace?
added in 3.0
(whitespace? s)checks if the string is all whitespace
(whitespace? " ") => true
wrap
added in 3.0
(wrap f)enables string-like ops for more types
((wrap #(str ’+ % ’+)) ’hello) => ’+hello+