diff options
author | Arun Isaac | 2022-07-08 16:08:04 +0530 |
---|---|---|
committer | Arun Isaac | 2022-07-08 16:08:39 +0530 |
commit | ff61a6cdd67e57358cca8efa4292949ea0c2398d (patch) | |
tree | c7ec575e1c6ebf499ae03329305a2fee23cfab21 | |
parent | ef69fdc1055aa78948ae4a43564970928078abad (diff) | |
download | tissue-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.scm | 6 |
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 |