what-the-bank/sources/o/gjJ.java

454 lines
14 KiB
Java

package o;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Objects;
import java.util.regex.Pattern;
/* loaded from: classes.dex */
public final class gjJ {
public static String a(String str, String str2) {
return str == null ? str2 : str;
}
static {
Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
}
public static boolean d(CharSequence charSequence, CharSequence charSequence2) {
if (charSequence != null && charSequence2 != null) {
int length = charSequence2.length();
int length2 = charSequence.length();
for (int i = 0; i <= length2 - length; i++) {
if (C15176gjG.d(charSequence, true, i, charSequence2, length)) {
return true;
}
}
}
return false;
}
public static boolean d(CharSequence charSequence, char... cArr) {
if (charSequence == null) {
return false;
}
if (charSequence.length() == 0) {
return true;
}
int length = cArr.length;
if (charSequence != null && charSequence.length() != 0 && !gjD.e(cArr)) {
int length2 = charSequence.length();
int length3 = cArr.length;
int i = 0;
while (true) {
if (i >= length2) {
break;
}
char charAt = charSequence.charAt(i);
for (int i2 = 0; i2 <= 0; i2++) {
if (cArr[i2] == charAt && (i >= length2 - 1 || i2 >= 0 || !Character.isHighSurrogate(charAt) || cArr[i2 + 1] == charSequence.charAt(i + 1))) {
i++;
}
}
if (i != -1) {
return false;
}
}
}
return true;
}
public static boolean a(CharSequence charSequence, CharSequence charSequence2) {
if (charSequence == charSequence2) {
return true;
}
if (charSequence == null || charSequence.length() != charSequence2.length()) {
return false;
}
return C15176gjG.d(charSequence, true, 0, charSequence2, charSequence.length());
}
@Deprecated
public static int b(CharSequence charSequence, CharSequence charSequence2) {
if (charSequence == null || charSequence2 == null) {
throw new IllegalArgumentException("Strings must not be null");
}
int length = charSequence.length();
int length2 = charSequence2.length();
if (length == 0) {
return length2;
}
if (length2 == 0) {
return length;
}
if (length > length2) {
length2 = charSequence.length();
length = length2;
} else {
charSequence2 = charSequence;
charSequence = charSequence2;
}
int[] iArr = new int[length + 1];
for (int i = 0; i <= length; i++) {
iArr[i] = i;
}
for (int i2 = 1; i2 <= length2; i2++) {
int i3 = iArr[0];
char charAt = charSequence.charAt(i2 - 1);
iArr[0] = i2;
int i4 = 1;
while (i4 <= length) {
int i5 = iArr[i4];
int i6 = i4 - 1;
iArr[i4] = Math.min(Math.min(iArr[i6] + 1, iArr[i4] + 1), i3 + (charSequence2.charAt(i6) == charAt ? 0 : 1));
i4++;
i3 = i5;
}
}
return iArr[length];
}
public static boolean b(CharSequence charSequence) {
return charSequence == null || charSequence.length() == 0;
}
public static boolean d(CharSequence charSequence) {
return !e(charSequence);
}
public static String b(Iterable<?> iterable, String str) {
Iterator<?> it;
if (iterable == null || (it = iterable.iterator()) == null) {
return null;
}
if (!it.hasNext()) {
return "";
}
Object next = it.next();
if (!it.hasNext()) {
return Objects.toString(next, "");
}
StringBuilder sb = new StringBuilder(256);
if (next != null) {
sb.append(next);
}
while (it.hasNext()) {
sb.append(str);
Object next2 = it.next();
if (next2 != null) {
sb.append(next2);
}
}
return sb.toString();
}
public static String a(String str, int i, char c) {
String str2;
while (str != null) {
int length = i - str.length();
if (length <= 0) {
return str;
}
if (length > 8192) {
String valueOf = String.valueOf(c);
if (str == null) {
return null;
}
if (valueOf == null || valueOf.length() == 0) {
valueOf = " ";
}
int length2 = valueOf.length();
int length3 = i - str.length();
if (length3 <= 0) {
return str;
}
if (length2 != 1 || length3 > 8192) {
if (length3 == length2) {
return valueOf.concat(str);
}
if (length3 < length2) {
return valueOf.substring(0, length3).concat(str);
}
char[] cArr = new char[length3];
char[] charArray = valueOf.toCharArray();
for (int i2 = 0; i2 < length3; i2++) {
cArr[i2] = charArray[i2 % length2];
}
return new String(cArr).concat(str);
}
c = valueOf.charAt(0);
} else {
if (length <= 0) {
str2 = "";
} else {
char[] cArr2 = new char[length];
Arrays.fill(cArr2, c);
str2 = new String(cArr2);
}
return str2.concat(str);
}
}
return null;
}
public static String c(String str, int i) {
if (str == null) {
return null;
}
if (i <= 0) {
return "";
}
int length = str.length();
if (i == 1 || length == 0) {
return str;
}
if (length == 1 && i <= 8192) {
char charAt = str.charAt(0);
if (i <= 0) {
return "";
}
char[] cArr = new char[i];
Arrays.fill(cArr, charAt);
return new String(cArr);
}
int i2 = length * i;
if (length == 1) {
char charAt2 = str.charAt(0);
if (i <= 0) {
return "";
}
char[] cArr2 = new char[i];
Arrays.fill(cArr2, charAt2);
return new String(cArr2);
}
if (length == 2) {
char charAt3 = str.charAt(0);
char charAt4 = str.charAt(1);
char[] cArr3 = new char[i2];
for (int i3 = (i << 1) - 2; i3 >= 0; i3 -= 2) {
cArr3[i3] = charAt3;
cArr3[i3 + 1] = charAt4;
}
return new String(cArr3);
}
StringBuilder sb = new StringBuilder(i2);
for (int i4 = 0; i4 < i; i4++) {
sb.append(str);
}
return sb.toString();
}
public static String c(String str) {
if (str == null) {
return null;
}
return new StringBuilder(str).reverse().toString();
}
public static String b(String str) {
return str == null ? "" : str;
}
public static boolean e(CharSequence charSequence, CharSequence charSequence2) {
if (charSequence == null || charSequence2 == null) {
return charSequence == charSequence2;
}
if (charSequence2.length() > charSequence.length()) {
return false;
}
return C15176gjG.d(charSequence, true, charSequence.length() - charSequence2.length(), charSequence2, charSequence2.length());
}
public static String d(String str) {
if (str == null || str.length() == 0) {
return str;
}
int length = str.length();
char[] cArr = new char[length];
int i = 0;
for (int i2 = 0; i2 < length; i2++) {
if (!Character.isWhitespace(str.charAt(i2))) {
cArr[i] = str.charAt(i2);
i++;
}
}
return i == length ? str : i == 0 ? "" : new String(cArr, 0, i);
}
public static boolean a(CharSequence charSequence) {
return !(charSequence == null || charSequence.length() == 0);
}
public static boolean e(CharSequence charSequence) {
int length = charSequence == null ? 0 : charSequence.length();
if (length == 0) {
return true;
}
for (int i = 0; i < length; i++) {
if (!Character.isWhitespace(charSequence.charAt(i))) {
return false;
}
}
return true;
}
public static boolean c(CharSequence charSequence) {
if (charSequence == null || charSequence.length() == 0) {
return false;
}
int length = charSequence.length();
for (int i = 0; i < length; i++) {
if (!Character.isDigit(charSequence.charAt(i))) {
return false;
}
}
return true;
}
public static String d(String str, String str2) {
return (str == null || str.length() == 0 || str2.length() == 0 || !str.endsWith(str2)) ? str : str.substring(0, str.length() - str2.length());
}
public static String b(String str, String str2) {
int length = str == null ? 0 : str.length();
if (length == 0) {
return str;
}
if (str2 == null) {
while (length != 0 && Character.isWhitespace(str.charAt(length - 1))) {
length--;
}
} else {
if (str2.isEmpty()) {
return str;
}
while (length != 0 && str2.indexOf(str.charAt(length - 1)) != -1) {
length--;
}
}
return str.substring(0, length);
}
public static String g(String str, String str2) {
int lastIndexOf;
return (str == null || str.length() == 0) ? str : (str2.length() == 0 || (lastIndexOf = str.lastIndexOf(str2)) == -1 || lastIndexOf == str.length() - str2.length()) ? "" : str.substring(lastIndexOf + str2.length());
}
public static String[] c(String str, String str2) {
int i;
boolean z;
int i2;
if (str == null) {
return null;
}
int length = str.length();
if (length == 0) {
return gjD.c;
}
ArrayList arrayList = new ArrayList();
if (str2.length() == 1) {
char charAt = str2.charAt(0);
i = 0;
z = false;
i2 = 0;
int i3 = 1;
while (i < length) {
if (str.charAt(i) == charAt) {
if (z) {
if (i3 == -1) {
i = length;
}
arrayList.add(str.substring(i2, i));
i3++;
z = false;
}
i2 = i + 1;
i = i2;
} else {
i++;
z = true;
}
}
} else {
i = 0;
z = false;
i2 = 0;
int i4 = 1;
while (i < length) {
if (str2.indexOf(str.charAt(i)) >= 0) {
if (z) {
if (i4 == -1) {
i = length;
}
arrayList.add(str.substring(i2, i));
i4++;
z = false;
}
i2 = i + 1;
i = i2;
} else {
i++;
z = true;
}
}
}
if (z) {
arrayList.add(str.substring(i2, i));
}
return (String[]) arrayList.toArray(gjD.c);
}
public static String e(String str, String str2) {
int i = 0;
int length = str == null ? 0 : str.length();
if (length == 0) {
return str;
}
if (str2 == null) {
while (i != length && Character.isWhitespace(str.charAt(i))) {
i++;
}
} else {
if (str2.isEmpty()) {
return str;
}
while (i != length && str2.indexOf(str.charAt(i)) != -1) {
i++;
}
}
return str.substring(i);
}
public static boolean c(CharSequence charSequence, CharSequence charSequence2) {
if (charSequence == null) {
return charSequence == charSequence2;
}
int length = charSequence2.length();
if (length > charSequence.length()) {
return false;
}
return C15176gjG.d(charSequence, false, 0, charSequence2, length);
}
public static String f(String str, String str2) {
if (str == null || str.length() == 0 || str2 == null) {
return str;
}
if (str2.isEmpty()) {
return "";
}
int indexOf = str.indexOf(str2);
return indexOf == -1 ? str : str.substring(0, indexOf);
}
public static String h(String str, String str2) {
int indexOf;
int indexOf2;
if (!gjI.b(str, str2, str2) || (indexOf = str.indexOf(str2)) == -1 || (indexOf2 = str.indexOf(str2, str2.length() + indexOf)) == -1) {
return null;
}
return str.substring(indexOf + str2.length(), indexOf2);
}
}