Skip to content

Instantly share code, notes, and snippets.

@pbalduino
Created April 5, 2012 17:24
Show Gist options
  • Save pbalduino/2312673 to your computer and use it in GitHub Desktop.
Save pbalduino/2312673 to your computer and use it in GitHub Desktop.
(def ^{:private true} empty-string "")
(def ^{:private true} single-comma ",")
(def ^{:private true} l-or-st #"(((L|ST)=\w*)| )")
(def ^{:private true} multiple-commas #"(,{2,}|,*\z)")
(def ^{:private true} lost-commas #"(\A,*|,*\z)")
(defn- remove-local [issuer-name]
(reduce
(fn[a b]
(replace a (first b) (second b)))
[issuer-name
[l-or-st empty-string]
[multiple-commas single-comma]
[lost-commas empty-string]]))
@pbalduino
Copy link
Author

(replace
  (replace
    (replace issuer-name l-or-st empty-string) 
  multiple-commas single-comma) 
lost-commas empty-string)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment