Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/StringUtils.java

Issue 29348632: Issue 4260 - Replace Apache Commons Lang classes (Closed)
Patch Set: Created July 22, 2016, 5:58 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/org/adblockplus/android/StringUtils.java
diff --git a/src/org/adblockplus/android/StringUtils.java b/src/org/adblockplus/android/StringUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..7ef1315f52b02eb0f7658de2e7b715a32956fee8
--- /dev/null
+++ b/src/org/adblockplus/android/StringUtils.java
@@ -0,0 +1,56 @@
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-2016 Eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package org.adblockplus.android;
+
+public class StringUtils
+{
+ public static boolean isNotEmpty(String value)
+ {
+ return value != null && value.length() > 0;
+ }
+
+ public static boolean isEmpty(String value)
+ {
+ return !isNotEmpty(value);
+ }
+
+ public static String join(Object[] array, String separator)
anton 2016/07/22 18:02:17 tested according to https://commons.apache.org/pro
+ {
+ if (array == null)
+ {
+ return null;
+ }
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < array.length; i++)
+ {
+ String eachValue = (String)array[i];
anton 2016/07/26 12:45:38 this could be array[i].toString() but currently wo
René Jeschke 2016/07/26 13:14:44 Yeah. As we pass in 'Object[]' I really would love
anton 2016/07/26 13:22:04 Acknowledged.
+ if (i > 0 && separator != null)
+ {
+ sb.append(separator);
+ }
+
+ if (eachValue != null)
+ {
+ sb.append(eachValue);
+ }
+ }
+
+ return sb.toString();
+ }
+}

Powered by Google App Engine
This is Rietveld