I have a phone number that looks like this:
(def phone_number "1112224444")
When I try this:
(string/format (string/slice phone_number 0 3)
(string/slice phone_number 3 6)
(string/slice phone_number 6 10))
I only get 111
I want to get 111-222-4444
>Solution :
You need to use string/format with %s:
(string/format "%s-%s-%s" (string/slice phone_number 0 3)
(string/slice phone_number 3 6)
# You can also use 6 -1 (this works no matter the length
# of the string).
(string/slice phone_number 6 10))
# Output: 111-222-4444