+ public static String trim(@Nullable String string) {
+ if (string == null)
+ return null;
+
+ return string.trim();
+ }
+ @Contract(value = "null, null -> true; null, !null -> false; !null, null -> false", pure = true)
+ public static boolean equalIntegers(Integer a, Integer b) {
+ if (a == null && b == null)
+ return true;
+ if (a == null || b == null)
+ return false;
+
+ return a.equals(b);
+ }
+ @Contract(value = "null, null -> true; null, !null -> false; !null, null -> false", pure = true)
+ public static boolean equalLongs(Long a, Long b) {
+ if (a == null && b == null)
+ return true;
+ if (a == null || b == null)
+ return false;
+
+ return a.equals(b);
+ }
+ public static void onMainThread(Runnable r) {
+ new Handler(Looper.getMainLooper()).post(r);
+ }
+ public static String addWrapHints(String input) {
+ if (input == null)
+ return null;
+ StringBuilder result = new StringBuilder();
+ int lastPos = 0;
+ int pos = input.indexOf(':');
+
+ while (pos >= 0) {
+ result.append(input.substring(lastPos, pos + 1))
+ .append(ZERO_WIDTH_SPACE);
+ lastPos = pos + 1;
+ pos = input.indexOf(':', lastPos + 1);
+ }
+ if (lastPos > 0)
+ result.append(input.substring(lastPos));
+
+ return result.toString();
+ }