diff options
Diffstat (limited to 'bundle-plugin/src/main/scala/com/yahoo/container/plugin/util/Strings.scala')
-rw-r--r-- | bundle-plugin/src/main/scala/com/yahoo/container/plugin/util/Strings.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bundle-plugin/src/main/scala/com/yahoo/container/plugin/util/Strings.scala b/bundle-plugin/src/main/scala/com/yahoo/container/plugin/util/Strings.scala new file mode 100644 index 00000000000..a0c3c1d001f --- /dev/null +++ b/bundle-plugin/src/main/scala/com/yahoo/container/plugin/util/Strings.scala @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.container.plugin.util + + /** + * @author tonytv + */ +object Strings { + def emptyStringTo(replacement: String)(s: String) = { + if (s.isEmpty) replacement + else s + } + + def noneIfEmpty(s: String) = Option(s).filterNot(_.isEmpty) +} |