From ff61a6cdd67e57358cca8efa4292949ea0c2398d Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 8 Jul 2022 16:08:04 +0530 Subject: utils: Add string-remove-suffix utility. * tissue/utils.scm (string-remove-suffix): New public function. --- tissue/utils.scm | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.3