changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/obj/url.lisp

changeset 698: 96958d3eb5b0
parent: f6a340b92274
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; obj/url.lisp --- Universal Resource Locators
2 
3 ;; Implements some conveniences for URLs.
4 
5 ;;; Commentary:
6 
7 ;; This is based on QURI which is more flexible than the hunchentoot
8 ;; url-encode package.
9 
10 ;;; Code:
11 (in-package :obj/url)
12 
13 ;;; String Utils
14 (defun starts-with-scheme-p (string)
15  "Check whether the string STRING represents a URL which starts with
16 a scheme, i.e. something like 'https://' or 'mailto:'."
17  (loop with scheme-char-seen-p = nil
18  for c across string
19  when (or (char-not-greaterp #\a c #\z)
20  (digit-char-p c)
21  (member c '(#\+ #\- #\.) :test #'char=))
22  do (setq scheme-char-seen-p t)
23  else return (and scheme-char-seen-p
24  (char= c #\:))))