Browse Source

add slugify function to utils package.

This replaces white spaces in a string with a hyphen ('-'). I prefer
file names to be stored with no white space, which is where I intend
to use this function the most.
stable
Craig Oates 2 years ago
parent
commit
3dbb603831
  1. 8
      src/utils.lisp

8
src/utils.lisp

@ -14,7 +14,9 @@
#:get-alert
#:get-and-reset-alert
#:bool-to-checkbox
#:checkbox-to-bool)
#:checkbox-to-bool
#:asciify
#:slugify)
(:documentation "Utilities that do not depend on models."))
(in-package #:utils)
@ -22,6 +24,10 @@
(defun asciify (string)
(str:downcase (slug:asciify string)))
(defun slugify (string)
"Turns a string of text into a slug."
(str:downcase (slug:slugify string)))
(defun request-params (request)
(loop :for (key . value) :in request
:collect (let ((*package* (find-package :keyword)))

Loading…
Cancel
Save