aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-11-22 12:54:06 +0300
committerMunyoki Kilyungi2023-11-22 12:54:06 +0300
commit7c57895d09f6eb9f8f53b20931a84297c4d3e64a (patch)
tree59ac9a115beeb02fec0f678336907a9cbd64002b
parent461e595eff40675c527ff1a339f736df086d0eb2 (diff)
downloadgn-transform-databases-7c57895d09f6eb9f8f53b20931a84297c4d3e64a.tar.gz
Add 'lower-case-and-replace-spaces' function
* transform/strings.scm (lower-case-and-replace-spaces): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--transform/strings.scm9
1 files changed, 9 insertions, 0 deletions
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