Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 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