summaryrefslogtreecommitdiff
path: root/functions/ensure_ending_period.pp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-05-05 00:31:37 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-05-05 00:31:37 +0200
commiteb38e6252b3c52a44d0d33679b3bc3178674c7f8 (patch)
treeb7958e38f9893c347af4c04a53f65a103cef3292 /functions/ensure_ending_period.pp
parentInitial commit (diff)
downloaddns-eb38e6252b3c52a44d0d33679b3bc3178674c7f8.tar.gz
dns-eb38e6252b3c52a44d0d33679b3bc3178674c7f8.tar.xz
Everything
Diffstat (limited to '')
-rw-r--r--functions/ensure_ending_period.pp8
1 files changed, 8 insertions, 0 deletions
diff --git a/functions/ensure_ending_period.pp b/functions/ensure_ending_period.pp
new file mode 100644
index 0000000..76c0003
--- /dev/null
+++ b/functions/ensure_ending_period.pp
@@ -0,0 +1,8 @@
+# Adds a period to end of string if not already present
+function dns::ensure_ending_period(String $s) >> String {
+ if $s[-1] == '.' {
+ $s
+ } else {
+ "${s}."
+ }
+}