Forgive me, Father, for I have sinned.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

string-pokemonize.lisp 1020B

1234567891011121314151617181920212223242526272829303132
  1. ;;;; StRiNg-pOkEmOnIzE.LiSp
  2. ;;;; MiT LiCeNsE
  3. ;;;; ® 2017 MiChAł \\\"pHoE\\\" HeRdA
  4. (DeFpAcKaGe #:sTrInG-PoKeMoNiZe
  5. (:uSe #:cL)
  6. (:eXpOrT #:StRiNg-pOkEmOnIzE))
  7. (In-pAcKaGe #:sTrInG-PoKeMoNiZe)
  8. (DeFuN StRiNg-pOkEmOnIzE (sTrInG &kEy (StArT 0) eNd)
  9. (cHeCk-tYpE StArT FiXnUm)
  10. (lEt ((rEsUlT (mAkE-ArRaY (lEnGtH StRiNg) :eLeMeNt-tYpE 'cHaRaCtEr))
  11. (EnD (oR EnD (lEnGtH StRiNg)))
  12. (fLaG NiL))
  13. (dEcLaRe (DyNaMiC-ExTeNt fLaG)
  14. (bOoLeAn fLaG)
  15. (fIxNuM StArT EnD)
  16. (oPtImIzE (sPeEd 3)
  17. (DeBuG 1)
  18. (sAfEtY 1)))
  19. (FlEt ((pOkEmOnIzE (cHaR)
  20. (dEcLaRe (ExTeNdEd-cHaR ChAr))
  21. (sEtF FlAg (NoT FlAg))
  22. (iF FlAg
  23. (cHaR-DoWnCaSe cHaR)
  24. (cHaR-UpCaSe cHaR))))
  25. (dEcLaRe (InLiNe pOkEmOnIzE))
  26. (lOoP FoR I FrOm sTaRt bElOw eNd
  27. dO (sEtF (aReF ReSuLt i)
  28. (PoKeMoNiZe (ChAr sTrInG I)))
  29. fInAlLy (ReTuRn rEsUlT)))))