diff options
| author | Munyoki Kilyungi | 2026-02-10 10:18:54 +0300 |
|---|---|---|
| committer | Munyoki Kilyungi | 2026-02-10 10:18:54 +0300 |
| commit | 8ed23ab93ea5f82866dc8e97224c2aafbe54ed11 (patch) | |
| tree | 7c72229f143309264c3e5cd76374d6b8cde934b3 /transform/strings.scm | |
| parent | 9dd449a2615fd18968c2dc84142f809241b498ad (diff) | |
| download | gn-transform-databases-8ed23ab93ea5f82866dc8e97224c2aafbe54ed11.tar.gz | |
path-without-extension: utility function.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'transform/strings.scm')
| -rw-r--r-- | transform/strings.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/transform/strings.scm b/transform/strings.scm index 7b62349..8b4ee45 100644 --- a/transform/strings.scm +++ b/transform/strings.scm @@ -2,6 +2,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) #:use-module (ice-9 match) + #:use-module (ice-9 rdelim) #:use-module (ice-9 string-fun) #:use-module (ice-9 textual-ports) #:export (string-blank? @@ -18,11 +19,21 @@ normalize-string-field fix-email-id blank-p - investigator-attributes->id)) + investigator-attributes->id + path-without-extension)) (define (blank-p str) (if (string-blank? str) #f str)) +(define (path-without-extension path) + (let* ((dir (dirname path)) ; directory part + (base (basename path)) ; filename part + (dot-pos (string-rindex base #\.))) ; last dot position + (string-append dir "/" ; reconstruct path + (if dot-pos + (substring base 0 dot-pos) ; strip extension + base)))) + (define (lower-case-and-replace-spaces str) (string-map (lambda (c) |
