Skip to content

Instantly share code, notes, and snippets.

@dvnmk
Created January 20, 2015 13:08
Show Gist options
  • Save dvnmk/b63dcd75581f52eb9226 to your computer and use it in GitHub Desktop.
Save dvnmk/b63dcd75581f52eb9226 to your computer and use it in GitHub Desktop.
"aBcDe2" -> "AbCdE2"
(defun toggle-case (string)
""aBcDe" -> "AbCdE""
(do* ((i 0 (+ i 1))
(len (length string))
(res string))
((equal i len) res)
(let ((ele (aref string i)))
(if (< ele 91) ; ascii A 65 ~ Z 90, a 97 ~ z 122
(aset string i (downcase ele))
(aset string i (upcase ele))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment