Capitalize strings with support for prepositions and acronyms.
Functions for capitalizing strings in a way that respects Brazilian Portuguese conventions, handling prepositions, acronyms, and custom word rules.
Examples: (capitalize "esponja de aço") ;; => "Esponja de Aço" (capitalize "josé ama maria" {:lower-case-words ["ama"]}) ;; => "José ama Maria"
Capitalize strings with support for prepositions and acronyms.
Functions for capitalizing strings in a way that respects Brazilian Portuguese
conventions, handling prepositions, acronyms, and custom word rules.
Examples:
(capitalize "esponja de aço") ;; => "Esponja de Aço"
(capitalize "josé ama maria" {:lower-case-words ["ama"]}) ;; => "José ama Maria"Common Brazilian acronyms that should always be uppercase.
Common Brazilian acronyms that should always be uppercase.
(capitalize text)(capitalize text
{:keys [lower-case-words upper-case-words]
:or {lower-case-words prepositions upper-case-words acronyms}})Capitalizes a string according to capitalization rules.
Rules:
Args: text - The string to capitalize options - Optional map with: :lower-case-words - Vector of words to keep lowercase (default: PREPOSITIONS) :upper-case-words - Vector of words to keep uppercase (default: ACRONYMS)
Returns: The capitalized string
Examples: (capitalize "esponja de aço") ;; => "Esponja de Aço" (capitalize "josé ama maria" {:lower-case-words ["ama"]}) ;; => "José ama Maria" (capitalize "doc da empresa ab" {:upper-case-words ["DOC" "AB"]}) ;; => "DOC da Empresa AB"
Capitalizes a string according to capitalization rules.
Rules:
- Words in lower-case-words (default: PREPOSITIONS) are kept lowercase, except the first word
- Words in upper-case-words (default: ACRONYMS) are converted to uppercase
- All other words have first letter capitalized, rest lowercase
- Multiple spaces are normalized to single spaces
- Empty strings are returned as-is
Args:
text - The string to capitalize
options - Optional map with:
:lower-case-words - Vector of words to keep lowercase (default: PREPOSITIONS)
:upper-case-words - Vector of words to keep uppercase (default: ACRONYMS)
Returns:
The capitalized string
Examples:
(capitalize "esponja de aço") ;; => "Esponja de Aço"
(capitalize "josé ama maria" {:lower-case-words ["ama"]}) ;; => "José ama Maria"
(capitalize "doc da empresa ab" {:upper-case-words ["DOC" "AB"]}) ;; => "DOC da Empresa AB"Common Portuguese prepositions and conjunctions that should be lowercase.
Common Portuguese prepositions and conjunctions that should be lowercase.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |