From 80ea14aff671b29e34a4653b45d6b7c5598db3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 29 Jan 2023 17:37:37 +0100 Subject: Initial code add. --- functions/normalize_filename.pp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 functions/normalize_filename.pp (limited to 'functions') diff --git a/functions/normalize_filename.pp b/functions/normalize_filename.pp new file mode 100644 index 0000000..6910936 --- /dev/null +++ b/functions/normalize_filename.pp @@ -0,0 +1,7 @@ +# Should take any string, and replace all non-character letters with +# dashes, and downcase everything. +function xorg::normalize_filename ( + String $name, +) >> String { + $name.downcase().regsubst(/[^a-z0-9]/, '-') +} -- cgit v1.2.3