diff options
author | Florian Zschocke <f.zschocke+git@gmail.com> | 2020-04-05 13:07:25 +0200 |
---|---|---|
committer | Florian Zschocke <f.zschocke+git@gmail.com> | 2020-04-05 13:07:25 +0200 |
commit | a93cd37bc60b4f311692e0e9c6b0ddf320eb5c29 (patch) | |
tree | f48a9a963233f1f23d4e77e9ba9e908ea5bb6472 /src/main/java/com/gitblit/utils | |
parent | 08666d065be34a227a9b5bb16810280d8ee39178 (diff) | |
parent | 34e77ddf09e58ea0a817d31ed74a6bce574bff97 (diff) | |
download | gitblit-a93cd37bc60b4f311692e0e9c6b0ddf320eb5c29.tar.gz gitblit-a93cd37bc60b4f311692e0e9c6b0ddf320eb5c29.zip |
Merge branch 'master' into releaser1.9.1
Diffstat (limited to 'src/main/java/com/gitblit/utils')
-rw-r--r-- | src/main/java/com/gitblit/utils/StringUtils.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/utils/StringUtils.java b/src/main/java/com/gitblit/utils/StringUtils.java index b192c80b..442acbbf 100644 --- a/src/main/java/com/gitblit/utils/StringUtils.java +++ b/src/main/java/com/gitblit/utils/StringUtils.java @@ -57,6 +57,21 @@ public class StringUtils { }
/**
+ * Returns true if the character array represents an empty String.
+ * An empty character sequence is defined as a sequence that
+ * either has no characters at all, or no characters above
+ * '\u0020' (space).
+ *
+ * @param value
+ * @return true if value is null or represents an empty String
+ */
+ public static boolean isEmpty(char[] value) {
+ if (value == null || value.length == 0) return true;
+ for ( char c : value) if (c > '\u0020') return false;
+ return true;
+ }
+
+ /**
* Replaces carriage returns and line feeds with html line breaks.
*
* @param string
|