summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-07-08 16:08:04 +0530
committerArun Isaac2022-07-08 16:08:39 +0530
commitff61a6cdd67e57358cca8efa4292949ea0c2398d (patch)
treec7ec575e1c6ebf499ae03329305a2fee23cfab21
parentef69fdc1055aa78948ae4a43564970928078abad (diff)
downloadtissue-ff61a6cdd67e57358cca8efa4292949ea0c2398d.tar.gz
tissue-ff61a6cdd67e57358cca8efa4292949ea0c2398d.tar.lz
tissue-ff61a6cdd67e57358cca8efa4292949ea0c2398d.zip
utils: Add string-remove-suffix utility.
* tissue/utils.scm (string-remove-suffix): New public function.
-rw-r--r--tissue/utils.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/tissue/utils.scm b/tissue/utils.scm
index 7fac814..b90e708 100644
--- a/tissue/utils.scm
+++ b/tissue/utils.scm
@@ -23,6 +23,7 @@
#:use-module (ice-9 filesystem)
#:use-module (ice-9 popen)
#:export (string-remove-prefix
+ string-remove-suffix
human-date-string
call-with-current-directory
call-with-temporary-directory
@@ -34,6 +35,11 @@
"Remove PREFIX from STR."
(substring str (string-length prefix)))
+(define (string-remove-suffix suffix str)
+ "Remove SUFFIX from STR."
+ (substring str 0 (- (string-length str)
+ (string-length suffix))))
+
(define (human-date-string date)
"Return a human readable rendering of DATE."
(let ((elapsed-time