From 3f2a8ee5a6f3d9892f835a9590b8ae47d25c19e3 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 24 Apr 2019 14:44:09 +0700 Subject: [PATCH] Support "guarded expressions" when concatting String values. e.g. {"[" + {n} + " " + {s00e00} + "]"} https://www.filebot.net/forums/viewtopic.php?f=8&t=10719 --- source/net/filebot/format/ExpressionFormatMethods.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/net/filebot/format/ExpressionFormatMethods.java b/source/net/filebot/format/ExpressionFormatMethods.java index 03d0f961..66fc7d80 100644 --- a/source/net/filebot/format/ExpressionFormatMethods.java +++ b/source/net/filebot/format/ExpressionFormatMethods.java @@ -676,6 +676,11 @@ public class ExpressionFormatMethods { return '-' + self; } + public static String plus(String self, Closure closure) { + Object value = call(closure); + return value == null ? self : self + value; + } + private ExpressionFormatMethods() { throw new UnsupportedOperationException(); }