From 1a21eca5c70f2002dacdd2aa5f51ac43d15bae72 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 1 Jan 2026 14:33:59 +0000 Subject: work/utils: Add string-remove-prefix. --- ravanan/work/utils.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ravanan/work/utils.scm b/ravanan/work/utils.scm index 5e057e3..df1cf21 100644 --- a/ravanan/work/utils.scm +++ b/ravanan/work/utils.scm @@ -27,7 +27,8 @@ #:use-module (system foreign) #:use-module (system foreign-library) #:use-module (ravanan work vectors) - #:export (list->dotted-list + #:export (string-remove-prefix + list->dotted-list alist=? assoc-ref* assoc-set @@ -37,6 +38,11 @@ call-with-input-pipe call-with-atomic-output-file)) +(define (string-remove-prefix prefix str) + "Remove @var{prefix} from @var{str}, if present. Else, return @code{#f}." + (and (string-prefix? prefix str) + (substring str (string-length prefix)))) + (define (list->dotted-list lst) "Convert @var{lst} of 2-element lists into a true association list of pairs." -- cgit 1.4.1