From 7c57895d09f6eb9f8f53b20931a84297c4d3e64a Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 22 Nov 2023 12:54:06 +0300 Subject: Add 'lower-case-and-replace-spaces' function * transform/strings.scm (lower-case-and-replace-spaces): New function. Signed-off-by: Munyoki Kilyungi --- transform/strings.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/transform/strings.scm b/transform/strings.scm index 568feef..7d9bc82 100644 --- a/transform/strings.scm +++ b/transform/strings.scm @@ -13,8 +13,17 @@ remove-duplicates sanitize-rdf-string snake->lower-camel + lower-case-and-replace-spaces string-capitalize-first)) +(define (lower-case-and-replace-spaces str) + (string-map + (lambda (c) + (if (char=? c #\space) + #\- ; replace space with hyphen + c)) ; convert character to lower case + (string-downcase str))) + (define (time-unix->string seconds . maybe-format) "Given an integer saying the number of seconds since the Unix epoch (1970-01-01 00:00:00), SECONDS, format it as a human readable -- cgit v1.2.3