| 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..be7c0af193d9c371c4ede9ea9c5847db44e57761 |
| --- /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) |
|
René Jeschke
2016/07/28 11:46:22
We're using two-space indentation. ;-)
anton
2016/07/28 11:48:59
Yes, i know. I've been thinking we can approve the
|
| + { |
| + return value != null && value.length() > 0; |
| + } |
| + |
| + public static boolean isEmpty(String value) |
| + { |
| + return !isNotEmpty(value); |
| + } |
| + |
| + public static String join(Object[] array, String separator) |
| + { |
| + if (array == null) |
| + { |
| + return null; |
| + } |
| + |
| + StringBuilder sb = new StringBuilder(); |
| + for (int i = 0; i < array.length; i++) |
| + { |
| + String eachValue = array[i].toString(); |
| + if (i > 0 && separator != null) |
| + { |
| + sb.append(separator); |
| + } |
| + |
| + if (eachValue != null) |
| + { |
| + sb.append(eachValue); |
| + } |
| + } |
| + |
| + return sb.toString(); |
| + } |
| +} |