Create a string containing the names and favourite colours of each person near you.
For example: "Our favourite colours are green and purple"
""
;; Just simply use a string
"We all love purple"
;; Using a function you can create a string and join values to create a string
(str "My favorite colours are" " " "green" " " "and" " ""purple")
Use a function to see if a string contains a colour. See the Hint below if you are not sure how to start
For example, does the string "Rachel of York gave brown bread in vans" contain the colour brown?
()
(clojure.string/includes? "Rachel of York gave brown bread in vans" "brown")
####Hint::The
clojure.string
clojure.string
library Remember that there are specific functions you can use in theclojure.string
library
- clojure.string/split - split a string based on a pattern (regex)
- clojure.string/subs - get part of a string
- clojure.string/replace - replace part of the string based on a pattern (regex)
- clojure.string/includes? - does a string include another string (true or false)