cl-change-case

2023-10-21

Convert strings between camelCase, param-case, PascalCase and more

Upstream URL

github.com/rudolfochrist/cl-change-case

Author

Sebastian Christ

License

LLGPL
README

1NAME

cl-change-case --- Convert strings between camelCase, param-case, PascalCase and more

2VERSION

cat version
0.2.0

3SYNOPSIS

(use-package :cl-change-case)

(format t "~{~S~%~}"
        (list (camel-case "test string")
              (param-case "test string")
              (pascal-case "test string")))
"testString"
"test-string"
"TestString"

4DESCRIPTION

cl-change-case is library to convert strings between camelCase, PascalCase, snake_case, param-case, CONSTANT_CASE and more.

This is a Common Lisp port of blakeembrey/change-case released under The MIT License.

4.1Functions

:PROPERTIES::header-args: :results verbatim :exports both:END:

4.1.1lower-case

Return the string in lower case.

(lower-case "TEST STRING")
"test string"

4.1.2lower-case-first

Lower case of the first character of string.

(lower-case-first "TEST STRING")
"tEST STRING"

4.1.3string-lower-case-p

Test if all characters in string have lower case.

(string-lower-case-p "test string")
T

4.1.4upper-case

Return the string in upper case.

(upper-case "test string")
"TEST STRING"

4.1.5upper-case-first

Upper case the first character of string.

(upper-case-first "test string")
"Test string"

4.1.6string-upper-case-p

Test if all characters in string have upper case.

(string-upper-case-p "TEST STRING")
T

4.1.7no-case

Make string a lower case, space separated string.

(no-case "test_stringTest")
"test string test"

Optionally you can provide a different replacement string.

(no-case "test_stringTest" :replacement "$$")
"test$$string$$test"

4.1.8camel-case

Convert string to camelCase.

(camel-case "test_string")
"testString"

4.1.9dot-case

Convert string to dot.case.

(dot-case "Test String")
"test.string"

4.1.10header-case

Title case string but dash separated.

(header-case "test string")
"Test-String"

4.1.11param-case

Convert string to param-case.

(param-case "test string")
"test-string"

4.1.12pascal-case

Convert string to PascalCase.

(pascal-case "test string")
"TestString"

4.1.13path-case

Convert string to path/case.

(path-case "test string more")
"test/string/more"

4.1.14sentence-case

Makes string a lower case, space separated string with the first word capitalized.

(sentence-case "thisIsATestString")
"This is a test string"

4.1.15snake-case

Convert string to snake_case.

(snake-case "test string")
"test_string"

4.1.16swap-case

Reverse the case of each character in string.

(swap-case "PascalCase")
"pASCALcASE"

4.1.17title-case

Make string space separated with each word capitalized.

(title-case "this_is a_test_string")
"This Is A Test String"

4.1.18constant-case

Convert string to CONSTANT_CASE.

(constant-case "test string")
"TEST_STRING"

5AUTHOR

Sebastian Christ (mailto:rudolfo.christ@gmail.com)

6COPYRIGHT

Copyright (c) 2016 Sebastian Christ (rudolfo.christ@gmail.com)

Released under the LLGPL license.

7SEE ALSO

Dependencies (2)

  • cl-ppcre
  • fiveam
  • GitHub
  • Quicklisp