September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
15
Task/URL-encoding/Common-Lisp/url-encoding.lisp
Normal file
15
Task/URL-encoding/Common-Lisp/url-encoding.lisp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(defun needs-encoding-p (char)
|
||||
(not (digit-char-p char 36)))
|
||||
|
||||
(defun encode-char (char)
|
||||
(format nil "%~2,'0X" (char-code char)))
|
||||
|
||||
(defun url-encode (url)
|
||||
(apply #'concatenate 'string
|
||||
(map 'list (lambda (char)
|
||||
(if (needs-encoding-p char)
|
||||
(encode-char char)
|
||||
(string char)))
|
||||
url)))
|
||||
|
||||
(url-encode "http://foo bar/")
|
||||
Loading…
Add table
Add a link
Reference in a new issue