### Unindent String Lines Source: https://github.com/funcool/cuerdas/blob/master/README.md Example input string for the `str/unindent` function, showing lines with varying indentation levels. ```clojure (str/unindent "first line second line (indented) another line") ``` -------------------------------- ### Run Lumo with Cuerdas Dependency Source: https://github.com/funcool/cuerdas/blob/master/README.md Command to start Lumo (a self-hosted ClojureScript environment) with the Cuerdas library included in the classpath. ```shell lumo -c $(clojure -Srepro -Sdeps '{:deps {funcool/cuerdas {:mvn/version "X.Y.Z"}}}' -Spath) ``` -------------------------------- ### Format String with Sequential and Indexed Placeholders Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/ffmt` for string formatting using both sequential (`%`) and indexed (`%N`) placeholders. ```clojure (str/ffmt "url(%, %)" my-url my-label) ; sequential access (str/ffmt "url(%1, %2)" my-url my-label) ; indexed access ``` -------------------------------- ### Trim and Normalize Whitespace Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/clean` to trim leading/trailing whitespace and replace multiple internal spaces with a single space, handling `nil`. ```clojure (str/clean " a b ") ;; => "a b" (str/clean nil) ;; => nil ``` -------------------------------- ### Convert String to Sequence of Characters Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/chars` to return a sequence of single-character strings from an input string, handling `nil`. ```clojure (str/chars "bar") ;; => ["b" "a" "r"] (str/chars nil) ;; => nil ``` -------------------------------- ### Strip HTML Tags from String Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of using `str/strip-tags` to remove HTML tags from a string. The second example shows how to specify tags to preserve. ```clojure (str/strip-tags "

just some text

") ;; => "just some text" (str/strip-tags "

just some text

" ["p"]) ;; => "just some text" ``` -------------------------------- ### Capitalize First Character of String Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/capital` to uppercase the first character of a string, handling `nil` input. ```clojure (str/capital "foo") ;; => "Foo" (str/capital nil) ;; => nil ``` -------------------------------- ### Convert String to CamelCase Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/camel` to convert strings or keywords to camelCase format, handling `nil` input. ```clojure (str/camel "foo bar") ;; => "fooBar" (str/camel :foo_barBaz) ;; => "fooBarBaz" (str/camel nil) ;; => nil ``` -------------------------------- ### Check if String Starts With Prefix Source: https://github.com/funcool/cuerdas/blob/master/README.md Checks if the input string begins with the specified prefix. Returns true or false. If either the string or prefix is nil, it returns false. ```Clojure (str/starts-with? "foobar" "foo") ;; => true (str/starts-with? "foobar" nil) ;; => false (str/starts-with? nil "foo") ;; => false ``` -------------------------------- ### Check if String is Blank Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/blank?` to determine if a string is empty or contains only whitespace, including `nil`. ```clojure (str/blank? "foobar") ;; => false (str/blank? " ") ;; => true (str/blank? "") ;; => true (str/blank? nil) ;; => true ``` -------------------------------- ### Run Cuerdas Tests Source: https://github.com/funcool/cuerdas/blob/master/README.md Instructions for running tests in both Clojure and ClojureScript environments, leveraging Reader Conditionals for targeted implementation. ```Shell $ clojure -X:dev:test ``` ```Shell yarn install yarn test ``` -------------------------------- ### Require Cuerdas Core Namespace Source: https://github.com/funcool/cuerdas/blob/master/README.md Demonstrates how to require the `cuerdas.core` namespace and alias it as `str` for convenient use of its string manipulation functions. ```clojure (ns my.namespace (:require [cuerdas.core :as str])) ``` -------------------------------- ### Unindent String Lines Output Source: https://github.com/funcool/cuerdas/blob/master/README.md The resulting string after applying `str/unindent` to the input, demonstrating automatic whitespace stripping. ```text first line second line (indented) another line ``` -------------------------------- ### Convert String or Keyword to Kebab-Case Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string or keyword into a kebab-cased string. Returns `nil` for `nil` input. ```Clojure (str/kebab "Favorite BBQ food") ;; => "favorite-bbq-food" (str/kebab :favorite-bbq-food) ;; => "favorite-bbq-food" (str/kebab nil) ;; => nil ``` -------------------------------- ### Add Cuerdas Dependency to project.clj Source: https://github.com/funcool/cuerdas/blob/master/README.md Instructions for adding the `funcool/cuerdas` library as a dependency to a Clojure project using Leiningen or similar build tools. ```clojure funcool/cuerdas {:mvn/version "2025.05.26-411"} ``` -------------------------------- ### Reverse a String Source: https://github.com/funcool/cuerdas/blob/master/README.md Returns the input string with its characters in reverse order. If the input string is nil, it returns nil. ```Clojure (str/reverse "bar") ;; => "rab" (str/reverse nil) ;; => nil ``` -------------------------------- ### Collapse Whitespace in ClojureScript Source: https://github.com/funcool/cuerdas/blob/master/README.md Demonstrates requiring `cuerdas.core` in a ClojureScript REPL and using `str/collapse-whitespace` to normalize spaces. ```clojure cljs.user=> (require '[cuerdas.core :as str]) ;; => nil cljs.user=> (str/collapse-whitespace " foo bar ") ;; => "foo bar" ``` -------------------------------- ### Quote a String Source: https://github.com/funcool/cuerdas/blob/master/README.md Encloses a string in double quotes. If the input is nil, it returns nil. ```Clojure (str/quote "a") ;; => "\"a\"" (str/quote nil) ;; => nil ``` -------------------------------- ### Collapse Adjacent Whitespace to Single Space Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/collapse-whitespace` to convert any adjacent whitespace characters (including newlines) to a single space, handling `nil`. ```clojure (str/collapse-whitespace "a\n\nb") ;; => "a b" (str/collapse-whitespace nil) ;; => nil ``` -------------------------------- ### Slice a String Source: https://github.com/funcool/cuerdas/blob/master/README.md Extracts a section of a string and returns a new string. It takes start and optional end indices. If the input string is nil, it returns nil. ```Clojure (str/slice "123" 1) ;; => "23" (str/slice "1234" 1 3) ;; => "23" (str/slice nil 1 3) ;; => nil ``` -------------------------------- ### Convert String or Keyword to Human-Friendly Format Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string or keyword into a human-friendly format, typically lowercased with spaces. Returns `nil` for `nil` input. ```Clojure (str/human "JustNiceForReading") ;; => "just nice for reading" (str/human :great-for-csv-headers) ;; => "great for csv headers" (str/human nil) ;; => nil ``` -------------------------------- ### Check if String is Alphabetic Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/alpha?` to check if a string contains only alphabetic characters, including cases with `nil` and spaces. ```clojure (str/alpha? nil) ;; => false (str/alpha? " ") ;; => false (str/alpha? "Test") ;; => true ``` -------------------------------- ### Split String into Lines Source: https://github.com/funcool/cuerdas/blob/master/README.md Splits a string into a list of lines based on newline characters. Returns `nil` for `nil` input. ```Clojure (str/lines "foo\nbar") ;; => ["foo" "bar"] (str/lines nil) ;; => nil ``` -------------------------------- ### Find Index of Substring Source: https://github.com/funcool/cuerdas/blob/master/README.md Returns the first index of a specified value (string or character) within the input string. An optional starting index for the search can be provided. Returns nil if the value is not found or if the input string/value is nil. ```Clojure (str/index-of "foobar" "foo") ;; => 0 (str/index-of "foobar" nil) ;; => nil ``` -------------------------------- ### Escape Percent Sign in Formatted String Source: https://github.com/funcool/cuerdas/blob/master/README.md Shows how to escape the percent character (`%`) in `str/ffmt` by duplicating it. ```clojure (str/ffmt "%1%%" 1) ;; => "1%" (str/ffmt "%%%" 1) ;; => "%1" ``` -------------------------------- ### Check if String is Alphanumeric Source: https://github.com/funcool/cuerdas/blob/master/README.md Examples of `str/alnum?` to check if a string contains only alphanumeric characters, including cases with `nil` and empty strings. ```clojure (str/alnum? nil) ;; => false (str/alnum? "") ;; => false (str/alnum? "Test123") ;; => true ``` -------------------------------- ### Convert to Snake_Case String Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string or keyword into a snake_cased_string. If the input is nil, it returns nil. ```Clojure (str/snake "Slither-sliter Slither") ;; => "slither_slither_slither" (str/snake :slither-slither) ;; => "slither_slither" (str/snake nil) ;; => nil ``` -------------------------------- ### Interpolate String with Multiple Arguments Source: https://github.com/funcool/cuerdas/blob/master/README.md Illustrates that `str/istr` is variadic, allowing multiple arguments to be concatenated into the final string. ```clojure (str/istr "the value " "is ~{value}") ;; => "the value is 30" ``` -------------------------------- ### Repeat String N Times Source: https://github.com/funcool/cuerdas/blob/master/README.md Repeats a given string a specified number of times. If the input string is nil, it returns nil. ```Clojure (str/repeat "a" 3) ;; => "aaa" (str/repeat nil 3) ;; => nil ``` -------------------------------- ### Find Last Index of Substring Source: https://github.com/funcool/cuerdas/blob/master/README.md Returns the last index of a specified value (string or character) within the input string. An optional starting index for the backward search can be provided. Returns nil if the value is not found or if the input string/value is nil. ```Clojure (str/last-index-of "foobar" "foo") ;; => 0 (str/last-index-of "foobar" nil) ;; => nil ``` -------------------------------- ### Interpolate String with Expression Evaluation Source: https://github.com/funcool/cuerdas/blob/master/README.md Demonstrates `str/istr`'s ability to evaluate simple expressions within the interpolated string. ```clojure (str/istr "value = ~(inc value)") ;; => "value = 31" ``` -------------------------------- ### Create Keyword from String with Auto-Namespace Source: https://github.com/funcool/cuerdas/blob/master/README.md A flexible version of `clojure.core/keyword` that converts strings into keywords, automatically handling spaces and allowing for optional namespace specification. Returns `nil` for `nil` input. ```Clojure (str/keyword "just_doIt Right") ;; => :just-do-it-right (str/keyword "foo" "auto namespace me") ;; => :foo/auto-namespace-me ;; and assuming the user namespace (str/keyword *ns* "auto namespace me") ;; => :user/auto-namespace-me (str/keyword nil) ;; => nil ``` -------------------------------- ### Convert to URL Slug Source: https://github.com/funcool/cuerdas/blob/master/README.md Transforms a string or keyword into a URL-friendly slug. The `uslug` variant supports Unicode characters, which is more modern than traditional ASCII-only slugs. If the input is nil, it returns nil. ```Clojure (str/slug "Un �l�phant � l'or�e du bois") ;; => "un-elephant-a-loree-du-bois" (str/slug nil) ;; => nil ``` -------------------------------- ### Convert to PascalCase String Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string or keyword into PascalCase (also known as UpperCamelCase or ClassCase). Non-string/keyword inputs, such as nil, return nil. ```Clojure (str/pascal "my name is epeli") ;; => "MyNameIsEpeli" (str/pascal :some-record) ;; => "SomeRecord" (str/pascal nil) ;; => nil ``` -------------------------------- ### Convert String to Title Case (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string or keyword into a space-separated string with each word capitalized. Handles nil input. ```Clojure (str/title "a tale of two cities") ;; => "A Tale Of Two Cities" (str/title :title-case) ;; => "Title Case" (str/title nil) ;; => nil ``` -------------------------------- ### Convert String to Uppercase (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string to all upper-case characters in a locale-independent manner. For locale-aware conversion, use `locale-upper`. ```Clojure (str/upper "foobar") ;; => "FOOBAR" (str/upper nil) ;; => nil ``` -------------------------------- ### Interpolate String with Symbol Substitution Source: https://github.com/funcool/cuerdas/blob/master/README.md Shows basic usage of `str/istr` for string interpolation, allowing symbol substitution similar to ES6 template strings. ```clojure (def value 30) (str/istr "value = ~{value}") ;; => "value = 30" ``` -------------------------------- ### Right Trim String Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes whitespace or specified characters from the right side of a string. If the input string is nil, it returns nil. ```Clojure (str/rtrim " foo ") ;; => " foo" (str/rtrim "-foo-", "-") ;; => "-foo" (str/rtrim nil) ;; => nil ``` -------------------------------- ### Convert JavaScript Style Selector to CSS Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string from JavaScript-style camelCase to CSS-style kebab-case. Handles `nil` input by returning `nil`. ```Clojure (str/css-selector "PrependedWithDash") ;; => "-prepended-with-dash" (str/css-selector "noPrependedWithDash") ;; => "no-prepended-with-dash" (str/css-selector nil) ;; => nil ``` -------------------------------- ### Unquote a String (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes surrounding quotation marks from a string. Returns nil if the input string is nil. ```Clojure (str/unquote "\"a\"") ;; => "a" (str/unquote nil) ;; => nil ``` -------------------------------- ### Pad String with Characters Source: https://github.com/funcool/cuerdas/blob/master/README.md Pads a string with specified characters until it reaches a given total length. By default, it pads on the left with spaces. Options allow for custom padding characters and padding direction (left, right, or both). ```Clojure (str/pad "1" {:length 8}) ;; => " 1" (str/pad nil {:length 8}) ;; => nil (str/pad "1" {:length 8 :padding "0"}) ;; => "00000001" (str/pad "1" {:length 8 :padding "0" :type :right}) ;; => "10000000" (str/pad "1" {:length 8 :padding "0" :type :both}) ;; => "00001000" ``` -------------------------------- ### Convert CSS Style Selector to JavaScript Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string from CSS-style kebab-case to JavaScript-style camelCase or PascalCase. Returns `nil` for `nil` input. ```Clojure (str/js-selector "-pascal-case-me") ;; => "PascalCaseMe" (str/js-selector "camel-case-me") ;; => "camelCaseMe" (str/js-selector nil) ;; => nil ``` -------------------------------- ### Join List of Strings with Newlines (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Concatenates a list of strings, inserting a newline character between each element. This is the inverse operation of `lines`. ```Clojure (str/unlines ["foo" "nbar"]) ;; => "foo\nbar" (str/unlines nil) ;; => nil ``` -------------------------------- ### Format Strings with Indexed or Associative Interpolation Source: https://github.com/funcool/cuerdas/blob/master/README.md A versatile string formatting function supporting two modes: indexed and associative. Indexed mode uses `%s` tokens with ordered arguments. Associative mode uses named tokens like `%(name)s` or `$name` with a map, or indexed tokens like `$0` with a vector. `str/fmt` is an alias, but `istr` or `ffmt` macros are recommended for lower overhead. ```Clojure (str/format "hello %s and %s" "yen" "ciri") ;; => "hello yen and ciri" (str/format "hello %s and %s" "yen") ;; "hello yen and %s" (str/format "hello %(name)s" {:name "yen"}) ;; => "hello yen" (str/format "hello $name" {:name "yen"}) ;; => "hello yen" (str/format "hello $0" ["yen"]) ;; => "hello yen" ``` -------------------------------- ### Concatenate Strings and Values Source: https://github.com/funcool/cuerdas/blob/master/README.md Demonstrates `str/concat`, a macro variant of `clojure.core/str`, which is faster for string concatenation, especially in ClojureScript. It can concatenate strings and other values. ```clojure (str/concat "foo" 1 "bar") ;; => "foo1bar" ``` -------------------------------- ### Join Strings with Optional Separator Source: https://github.com/funcool/cuerdas/blob/master/README.md Concatenates a collection of strings, optionally using a specified separator. If no separator is provided, strings are joined directly. ```Clojure (str/join ["foo" "bar"]) ;; => "foobar" (str/join "," ["foo" "bar"]) ;; => "foo,bar" ``` -------------------------------- ### Check if String Ends with Suffix Source: https://github.com/funcool/cuerdas/blob/master/README.md Determines if a string ends with a specified suffix. Returns `false` if either the string or the suffix is `nil`. ```Clojure (str/ends-with? "foobar" "bar") ;; => true (str/ends-with? "foobar" nil) ;; => false (str/ends-with? nil "bar") ;; => false ``` -------------------------------- ### Trim Whitespace or Characters from String (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes leading and trailing whitespace or specified characters from a string. Returns nil if the input string is nil. ```Clojure (str/trim " foo ") ;; => "foo" (str/trim "-foo-", "-") ;; => "foo" (str/trim nil) ;; => nil ``` -------------------------------- ### Split String by Separator Source: https://github.com/funcool/cuerdas/blob/master/README.md Splits a string into a sequence of substrings based on a separator, which can be a string or a regular expression. An optional limit can be provided for the number of splits. If the input string is nil, it returns nil. ```Clojure (str/split "1 2 3") ;; => ["1" "2" "3"] (str/split "1 2 3" " ") ;; => ["1" "2" "3"]) (str/split "1 2 3" #"\s") ;; => ["1" "2" "3"] (str/split "1 2 3" #"\s" 2) ;; => ["1" "2 3"] (str/split nil) ;; => nil ``` -------------------------------- ### Convert to Capitalized Spaced Phrase Source: https://github.com/funcool/cuerdas/blob/master/README.md Transforms a potentially mixed string or keyword into a capitalized, space-separated phrase. It handles various casing conventions and trims leading/trailing whitespace. ```Clojure (str/phrase " capitalize dash-CamelCase_underscore trim ") ;; => "Capitalize dash camel case underscore trim" (str/phrase :nobody-uses-keywords-this-long-but-it-still-works) ;; => "Nobody uses keywords this long but it still works" (str/phrase nil) ;; => nil ``` -------------------------------- ### Replace All Occurrences in String Source: https://github.com/funcool/cuerdas/blob/master/README.md Replaces all instances of a match (string or regex) with a replacement string within the input string. If the input string is nil, it returns nil. ```Clojure (str/replace "aa bb aa" "aa" "kk") ;; => "kk bb kk" (str/replace "aa bb aa" #"aa" "kk") ;; => "kk bb kk" (str/replace nil #"aa" "kk") ;; => nil ``` -------------------------------- ### Remove Prefix from String Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes a specified prefix from the beginning of a string if it matches exactly. If the prefix does not match, the string remains unchanged. Returns nil if the input string or prefix is nil. ```Clojure (str/strip-prefix nil nil) ;; => nil (str/strip-prefix "a" nil) ;; => "a" (str/strip-prefix "-=a" "-=") ;; => "a" ``` -------------------------------- ### Unsurround a String (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes a specified surrounding string from both ends of an input string. Returns nil if the input string is nil. ```Clojure (str/unsurround "-a-" "-") ;; => "a" (str/unsurround "-^-a-^-" "-^-") ;; => "a" (str/unsurround nil "-") ;; => nil ``` -------------------------------- ### Check if String Contains Only Digits Source: https://github.com/funcool/cuerdas/blob/master/README.md Determines if a string consists solely of digit characters. Returns `false` for non-digit characters or `nil` input. ```Clojure (str/digits? nil) ;; => false (str/digits? "1.1") ;; => false (str/digits? "210") ;; => true ``` -------------------------------- ### Check if String is Empty Source: https://github.com/funcool/cuerdas/blob/master/README.md Checks if a string is empty. Returns `true` for an empty string or `nil`, and `false` for strings containing characters, including whitespace. ```Clojure (str/empty? "foobar") ;; => false (str/empty? "") ;; => true (str/empty? " ") ;; => false (str/empty? nil) ;; => true ``` -------------------------------- ### Surround String with Another String (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Encloses a string with a specified surrounding string on both ends. Returns nil if the input string is nil. ```Clojure (str/surround "a" "-") ;; => "-a-" (str/surround "a" "-^-") ;; => "-^-a-^-" (str/surround nil "-^-") ;; => nil ``` -------------------------------- ### Check if String Includes Substring Source: https://github.com/funcool/cuerdas/blob/master/README.md Determines whether a string contains a specified substring. Returns `false` if either the string or the substring is `nil`. ```Clojure (str/includes? "foobar" "bar") ;; => true (str/includes? "foobar" nil) ;; => false (str/includes? nil nil) ;; => false ``` -------------------------------- ### Replace First Occurrence in String Source: https://github.com/funcool/cuerdas/blob/master/README.md Replaces only the first instance of a match (string or regex) with a replacement string within the input string. If the input string is nil, it returns nil. ```Clojure (str/replace-first "aa bb aa" "aa" "kk") ;; => "kk bb aa" (str/replace-first "aa bb aa" #"aa" "kk") ;; => "kk bb aa" (str/replace-first nil #"aa" "kk") ;; => nil ``` -------------------------------- ### Convert String to Lowercase (Locale Independent) Source: https://github.com/funcool/cuerdas/blob/master/README.md Converts a string to all lowercase characters in a locale-independent manner. For locale-aware conversion, use `locale-lower`. Returns `nil` for `nil` input. ```Clojure (str/lower "FOO") ;; => "foo" (str/lower nil) ;; => nil ``` -------------------------------- ### Remove Characters from Left Side of String Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes leading whitespace or specified characters from the left side of a string. Returns `nil` for `nil` input. ```Clojure (str/ltrim " foo ") ;; => "foo " (str/ltrim "-foo-", "-") ;; => "foo-" (str/ltrim nil) ;; => nil ``` -------------------------------- ### Strip Newlines from String Source: https://github.com/funcool/cuerdas/blob/master/README.md Replaces all newline characters in a string with a single space. Multiple consecutive newlines are also replaced by a single space. If the input string is nil, it returns nil. ```Clojure (str/strip-newlines "a\n\nb") ;; => "a b" (str/strip-newlines nil) ;; => nil ``` -------------------------------- ### Extract Words from String (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Returns a vector of words found in the string. An optional regular expression can be provided to define what constitutes a word, defaulting to `[a-zA-Z0-9_-]+`. ```Clojure (str/words nil) ;; => nil (str/words "foo, bar") ;; => ["foo" "bar"] (str/words "foo, bar." #"[^, ]+") ;; => ["foo" "bar."] ``` -------------------------------- ### Check if String is a Word (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md A Unicode-aware version of `alnum?` that checks if a string consists of word characters. Returns false for nil or empty strings. ```Clojure (str/word? nil) ;; => false (str/word? "") ;; => false (str/word? "Русский222") ;; => true ``` -------------------------------- ### Convert String to Boolean (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Evaluates a string to a boolean value, returning true for case-insensitive '1', 'on', 'true', or 'yes'. All other values return false. ```Clojure (str/to-bool "hello") ;; => false (str/to-bool "on") ;; => true ``` -------------------------------- ### Remove Suffix from String (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes a specified suffix from a string if it matches exactly, otherwise leaves the string unchanged. Handles nil inputs gracefully. ```Clojure (str/strip-suffix nil nil) ;; => nil (str/strip-suffix "a" nil) ;; => "a" (str/strip-suffix "a=-" "=-") ;; => "a" ``` -------------------------------- ### Truncate String with Ellipsis Source: https://github.com/funcool/cuerdas/blob/master/README.md Truncates a string to a specified width, adding an ellipsis (...) if necessary. It ensures the pruned string does not exceed the original length and avoids cutting words in half. An optional custom suffix can be provided. ```Clojure (str/prune "Hello World" 5) ;; => "Hello..." (str/prune "Hello World" 8) ;; => "Hello..." (str/prune "Hello World" 11 " (...)") ;; => "Hello (...)" (str/prune nil 5) ;; => nil ``` -------------------------------- ### Check if String Contains Only Numeric Characters Source: https://github.com/funcool/cuerdas/blob/master/README.md Determines if a string consists solely of numeric characters, including decimals and scientific notation. Returns `false` for `nil` input. ```Clojure (str/numeric? nil) ;; => false (str/numeric? "1.1") ;; => true (str/numeric? "2e10") ;; => true ``` -------------------------------- ### Remove HTML Tags from String (Clojure) Source: https://github.com/funcool/cuerdas/blob/master/README.md Removes HTML tags from a string. Optionally allows specifying tags to preserve or providing a map for arbitrary replacements, such as converting
to a newline. ```Clojure (str/strip-tags "

just some text

") ;; => "just some text" (str/strip-tags "

just some text

" ["p"]) ;; => "just some text" (str/strip-tags nil) ;; => nil ``` ```Clojure (str/strip-tags "

just
text

" {:br "\n"}) ;; => "just\ntext" (str/strip-tags "

just
text

" ["br"] {:br "\n"}) ;; => "

just\ntext

" ``` -------------------------------- ### Check if String Contains Only Letters (Unicode Aware) Source: https://github.com/funcool/cuerdas/blob/master/README.md An unicode-aware function that checks if a string contains only letter characters. Returns `false` for `nil` or strings with non-letter characters (e.g., spaces, digits). ```Clojure (str/letters? nil) ;; => false (str/letters? " ") ;; => false (str/letters? "Test") ;; => true (str/letters? "Русский") ;; => true ``` -------------------------------- ### Version 0.8.0: Format Function Fixes and Improvements Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This version addresses a NullPointerException in the `format` function and enhances its string interpolation capabilities for greater flexibility. ```APIDOC API Changes for Version 0.8.0: - Fixes: - `format`: Fixed NPE. - Improvements: - `format`: Improved string interpolation flexibility. ``` -------------------------------- ### Version 0.1.0: Initial Release Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This marks the very first public release of the funcool/cuerdas library, providing initial string manipulation functionalities. ```APIDOC API Changes for Version 0.1.0: - Initial version of the library. ``` -------------------------------- ### Version 0.6.0: Build System and Source Unification Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This version focuses on internal build system improvements, including updating the ClojureScript compiler, removing `lein-cljsbuild` and `cljx` dependencies, and unifying the source code into a single directory. ```APIDOC API Changes for Version 0.6.0: - Build System Updates: - ClojureScript compiler updated to 1.7.28. - Switched to cljs own compiler facilities instead of `lein-cljsbuild`. - Removed `cljx` dependency and started using reader conditionals for tests. - Unified the source under one directory (instead of separate cljs and clj directories). ``` -------------------------------- ### Version 0.3.2: Unlines Function and Test Framework Switch Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This release adds the `unlines` function and replaces the `speclj` testing framework with `clojure.test` for consistency and maintenance. ```APIDOC API Changes for Version 0.3.2: - New Functions: - `unlines`. - Test Framework Changes: - Replaced `speclj` with `clojure.test`. - Dependencies: - Updated dependencies. ``` -------------------------------- ### Version 0.2.0: Dependency Removal and API Aliases/Renames Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This version removes the Apache Commons Lang dependency for Clojure, significantly improves nil handling across functions, and introduces new aliases for trimming functions while renaming `endswith?` and `startswith?` to `ends-with?` and `starts-with?` respectively, maintaining backward compatibility. ```APIDOC API Changes for Version 0.2.0: - Dependencies: - Removed Apache Commons Lang dependency (clj). - API Refinements: - Added proper nil handling for almost all functions. - Added `strip`, `rstrip`, and `lstrip` aliases for `trim`, `rtrim`, and `ltrim` respectively. - Renamed `endswith?` to `ends-with?` (previous name conserved as alias). - Renamed `startswith?` to `starts-with?` (previous name conserved as alias). - `strip-tags`: Added the ability for arbitrary replacements. ``` -------------------------------- ### Version 0.7.2: Format Function Null Pointer Exception Fix Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This release specifically fixes a null pointer exception that occurred in the `format` function when it was called without arguments, affecting only the Clojure implementation. ```APIDOC API Changes for Version 0.7.2: - Fixes: - `format`: Fixed null pointer exception when called without arguments (clj only). ``` -------------------------------- ### Version 0.3.1: Dependency Removal and Test Cases Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This version removes Clojure and ClojureScript from the required dependencies, making them optional, and includes additional test cases to improve code coverage and reliability. ```APIDOC API Changes for Version 0.3.1: - Dependencies: - Removed Clojure and ClojureScript from required dependencies. - Tests: - Added some additional testcases. ``` -------------------------------- ### Version 1.0.0: Major Breaking Changes, Renames, and New Features Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This major release introduces significant breaking changes, primarily through function renames for consistency, and adds new functionalities like HTML escaping, unicode-aware predicates, and string interpolation. It also refines existing functions for better performance and cross-platform compatibility. ```APIDOC API Changes for Version 1.0.0: - Renamed Functions: - `alpha-numeric?` -> `alnums?` - `numeric?` (old) -> `digits?` - `dasherize` -> `kebab` - `underscore` -> `snake` - `classify` -> `pascal` - `titleize` -> `title` - `humanize` -> `human` - `parse-long` (jvm impl) -> `parse-int` - `parse-float` (cljs impl) -> `parse-double` - `capitalize` -> `capital` - Removed Functions: - `ireplace-first` (cljs only) - `ireplace` (cljs only) - New Functions: - `js-selector` - `css-selector` - `escape-html` (clj) - `unescape-html` (clj) - `word?` (unicode aware predicate) - `letters?` (unicode aware predicate) - `numeric?` (new predicate) - `locale-upper` - `locale-lower` - `caseless=` - `locale-caseless=` - `uslug` (unicode friendly version of `slug`) - Aliases: - `fmt` for `format` - New Features: - String interpolation support (`<<` macro) - String unindentation support (`<<-` function) - Enhanced regular expression support via xregexp (cljs only) - Behavior Changes/Improvements: - `parse-number`: Made cross-platform, removed second arity. - `words`: Made unicode aware. - `blank?`: Made unicode aware. - `clean`: Made unicode aware. - `collapse-whitespace`: Made unicode aware. - `capital`: Improved performance. - `words`: Fixed nil safety inconsistency. - `replace` (cljs): Fixed wrong behavior. ``` -------------------------------- ### Version 0.3.0: Contains and Dasherize Bugfixes, New Strip Functions Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This release fixes bugs in the `contains?` and `dasherize` functions and introduces new utility functions, `strip-suffix` and `strip-prefix`, for string manipulation. ```APIDOC API Changes for Version 0.3.0: - Fixes: - `contains?`: Fixed bug. - `dasherize`: Fixed bug. - New Functions: - `strip-suffix`. - `strip-prefix`. ``` -------------------------------- ### Version 0.7.0: Reader Conditionals and New Functions Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This release introduces support for reader conditionals, requiring Clojure 1.7 or newer. It also modifies the behavior of `starts-with?`, `ends-with?`, and `contains?` for empty substrings, and adds several new utility functions. ```APIDOC API Changes for Version 0.7.0: - New Features: - Started using reader conditionals (Clojure >= 1.7 required). - Added various new functions: `to-bool`, `words`, `alpha?`. - Behavior Changes: - `starts-with?`, `ends-with?`, `contains?`: Now return true for empty substrings. - Fixes: - General bugfixing. ``` -------------------------------- ### Version 0.5.0: Substring Function and Type Hints Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This release introduces the `substr-between` function for extracting text between two delimiters and adds additional type hints to the Clojure code for improved performance and clarity. ```APIDOC API Changes for Version 0.5.0: - New Functions: - `substr-between`. - Improvements: - Added some additional type hints on Clojure code. ``` -------------------------------- ### Version 0.7.1: Prune Behavior Fix and Compiler Update Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This version corrects an unexpected behavior in the `prune` function and includes an update to the ClojureScript compiler version. ```APIDOC API Changes for Version 0.7.1: - Fixes: - `prune`: Fixed unexpected behavior. - Updates: - ClojureScript compiler version updated. ``` -------------------------------- ### Version 0.4.0: Package GroupId Change Source: https://github.com/funcool/cuerdas/blob/master/CHANGES.md This version primarily changes the Maven groupId of the package to `funcool`, aligning with the new organizational structure. ```APIDOC API Changes for Version 0.4.0: - Package Changes: - Changed the groupId of the package to `funcool`. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.