Created
July 20, 2020 10:50
-
-
Save codecitizen/533ea04c097ce0ed977aa4458b629fc6 to your computer and use it in GitHub Desktop.
PF.tv Issue 387 Challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns issue387 | |
(:require [clojure.string :as s])) | |
(defn asterisks [word] | |
(apply str (repeat (.length word) "*"))) | |
(defn clean-word [sample word] | |
(s/replace sample (re-pattern (str "(?i)" word)) (asterisks word))) | |
(defn clean [sample index] | |
(loop [s sample i index] | |
(if (empty? i) | |
s | |
(recur (clean-word s (first i)) (rest i))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment