From b7ce607c8b2f83786d1cf6647e6a22d31a05f541 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Tue, 11 Oct 2022 11:52:39 +0200 Subject: [PATCH] Add string extensions --- Sources/App/Extensions/String+Extensions.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Sources/App/Extensions/String+Extensions.swift diff --git a/Sources/App/Extensions/String+Extensions.swift b/Sources/App/Extensions/String+Extensions.swift new file mode 100644 index 0000000..88824bf --- /dev/null +++ b/Sources/App/Extensions/String+Extensions.swift @@ -0,0 +1,12 @@ +import Foundation + +extension String { + + var trimmed: String { + trimmingCharacters(in: .whitespacesAndNewlines) + } + + var nonEmpty: String? { + self == "" ? nil : self + } +}