Utilities to work with Brazilian cities by state (UF).
Utilities to work with Brazilian cities by state (UF).
(all-cities)Returns all cities with their respective states.
Returns a vector of maps with :state and :city keys.
Example: (all-cities) ;; [{:state :SP :city "São Paulo"} {:state :RJ :city "Rio de Janeiro"} ...]
Returns all cities with their respective states.
Returns a vector of maps with :state and :city keys.
Example:
(all-cities) ;; [{:state :SP :city "São Paulo"} {:state :RJ :city "Rio de Janeiro"} ...](all-city-names)Returns all city names without state context.
Returns a vector of strings with all city names (flat list).
Example: (all-city-names) ;; ["São Paulo" "Rio de Janeiro" "Salvador" ...]
Returns all city names without state context. Returns a vector of strings with all city names (flat list). Example: (all-city-names) ;; ["São Paulo" "Rio de Janeiro" "Salvador" ...]
(cities-of state)Returns all cities of a given state.
Arguments:
Returns a vector of strings with city names, or empty vector if state not found.
Example: (cities-of :SP) ;; ["São Paulo" "Campinas" ...]
Returns all cities of a given state. Arguments: - state: Keyword representing the state code (UF) Returns a vector of strings with city names, or empty vector if state not found. Example: (cities-of :SP) ;; ["São Paulo" "Campinas" ...]
(cities-of! state)Returns all cities of a given state or throws on invalid state.
Arguments:
Returns a vector of strings with city names. Throws ex-info with {:state <value>} if state is invalid.
Example: (cities-of! :SP) ;; ["São Paulo" "Campinas" ...] (cities-of! :XX) ;; throws ex-info
Returns all cities of a given state or throws on invalid state.
Arguments:
- state: Keyword representing the state code (UF)
Returns a vector of strings with city names.
Throws ex-info with {:state <value>} if state is invalid.
Example:
(cities-of! :SP) ;; ["São Paulo" "Campinas" ...]
(cities-of! :XX) ;; throws ex-info(city-exists? state city-name)Checks if a city exists in a given state.
Arguments:
Returns true if the city exists in that state, false otherwise.
Example: (city-exists? :SP "São Paulo") ;; true (city-exists? :SP "Rio de Janeiro") ;; false (city-exists? :RJ "Rio de Janeiro") ;; true
Checks if a city exists in a given state. Arguments: - state: Keyword representing the state code (UF) - city-name: String with the city name (case-insensitive) Returns true if the city exists in that state, false otherwise. Example: (city-exists? :SP "São Paulo") ;; true (city-exists? :SP "Rio de Janeiro") ;; false (city-exists? :RJ "Rio de Janeiro") ;; true
(find-city-by-name city-name)Finds all occurrences of a city by its name (case-insensitive).
Arguments:
Returns a vector of maps with :state and :city keys for all matches.
Example: (find-city-by-name "São Paulo") ;; [{:state :SP :city "São Paulo"}] (find-city-by-name "santa cruz") ;; Multiple cities named Santa Cruz in different states
Finds all occurrences of a city by its name (case-insensitive).
Arguments:
- city-name: String with the city name to search
Returns a vector of maps with :state and :city keys for all matches.
Example:
(find-city-by-name "São Paulo") ;; [{:state :SP :city "São Paulo"}]
(find-city-by-name "santa cruz") ;; Multiple cities named Santa Cruz in different statescljdoc 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 |