package o; import java.util.Iterator; /* renamed from: o.gei, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public class C15014gei extends C15015gej { public static final boolean a(String str, String str2, boolean z) { if (str == null) { return str2 == null; } if (!z) { return str.equals(str2); } return str.equalsIgnoreCase(str2); } public static final String a(String str, String str2, String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); String str4 = str; int e = gdZ.e((CharSequence) str4, str2, 0, false); if (e < 0) { return str; } int length = str2.length(); int i = length <= 0 ? 1 : length; int length2 = (str.length() - length) + str3.length(); if (length2 < 0) { throw new OutOfMemoryError(); } StringBuilder sb = new StringBuilder(length2); int i2 = 0; do { sb.append((CharSequence) str4, i2, e); sb.append(str3); i2 = e + length; if (e >= str.length()) { break; } e = gdZ.e((CharSequence) str4, str2, e + i, false); } while (e > 0); sb.append((CharSequence) str4, i2, str.length()); String obj = sb.toString(); C14957gcv.c((Object) obj, ""); return obj; } public static final boolean e(String str, String str2, boolean z) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); if (!z) { return str.startsWith(str2); } return gdZ.e(str, 0, str2, 0, str2.length(), z); } public static final boolean a(String str, String str2, int i, boolean z) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); if (!z) { return str.startsWith(str2, i); } return gdZ.e(str, i, str2, 0, str2.length(), z); } public static final boolean d(String str, String str2, boolean z) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); if (!z) { return str.endsWith(str2); } return gdZ.e(str, str.length() - str2.length(), str2, 0, str2.length(), true); } public static final boolean d(CharSequence charSequence) { C14957gcv.e(charSequence, ""); if (charSequence.length() == 0) { return true; } C14957gcv.e(charSequence, ""); Iterator it = new C14973gde(0, charSequence.length() - 1).iterator(); while (it.hasNext()) { char charAt = charSequence.charAt(((AbstractC14853gaL) it).a()); if (!Character.isWhitespace(charAt) && !Character.isSpaceChar(charAt)) { return false; } } return true; } public static final boolean e(String str, int i, String str2, int i2, int i3, boolean z) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); if (!z) { return str.regionMatches(i, str2, i2, i3); } return str.regionMatches(z, i, str2, i2, i3); } }