- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
799 lines
34 KiB
Java
799 lines
34 KiB
Java
package kotlin.text;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import kotlin.Pair;
|
|
import kotlin.TuplesKt;
|
|
import kotlin.collections.ArraysKt___ArraysJvmKt;
|
|
import kotlin.collections.ArraysKt___ArraysKt;
|
|
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
|
|
import kotlin.collections.CollectionsKt__IterablesKt;
|
|
import kotlin.collections.CollectionsKt___CollectionsKt;
|
|
import kotlin.collections.IntIterator;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.ranges.IntProgression;
|
|
import kotlin.ranges.IntRange;
|
|
import kotlin.ranges.RangesKt___RangesKt;
|
|
import kotlin.sequences.Sequence;
|
|
import kotlin.sequences.SequencesKt___SequencesKt;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class StringsKt__StringsKt extends StringsKt__StringsJVMKt {
|
|
public static CharSequence trim(CharSequence charSequence) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
int length = charSequence.length() - 1;
|
|
int i = 0;
|
|
boolean z = false;
|
|
while (i <= length) {
|
|
boolean isWhitespace = CharsKt__CharJVMKt.isWhitespace(charSequence.charAt(!z ? i : length));
|
|
if (z) {
|
|
if (!isWhitespace) {
|
|
break;
|
|
}
|
|
length--;
|
|
} else if (isWhitespace) {
|
|
i++;
|
|
} else {
|
|
z = true;
|
|
}
|
|
}
|
|
return charSequence.subSequence(i, length + 1);
|
|
}
|
|
|
|
public static String trim(String str, char... chars) {
|
|
boolean contains;
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(chars, "chars");
|
|
int length = str.length() - 1;
|
|
int i = 0;
|
|
boolean z = false;
|
|
while (i <= length) {
|
|
contains = ArraysKt___ArraysKt.contains(chars, str.charAt(!z ? i : length));
|
|
if (z) {
|
|
if (!contains) {
|
|
break;
|
|
}
|
|
length--;
|
|
} else if (contains) {
|
|
i++;
|
|
} else {
|
|
z = true;
|
|
}
|
|
}
|
|
return str.subSequence(i, length + 1).toString();
|
|
}
|
|
|
|
public static final CharSequence padStart(CharSequence charSequence, int i, char c) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
if (i < 0) {
|
|
throw new IllegalArgumentException("Desired length " + i + " is less than zero.");
|
|
}
|
|
if (i <= charSequence.length()) {
|
|
return charSequence.subSequence(0, charSequence.length());
|
|
}
|
|
StringBuilder sb = new StringBuilder(i);
|
|
IntIterator it = new IntRange(1, i - charSequence.length()).iterator();
|
|
while (it.hasNext()) {
|
|
it.nextInt();
|
|
sb.append(c);
|
|
}
|
|
sb.append(charSequence);
|
|
return sb;
|
|
}
|
|
|
|
public static String padStart(String str, int i, char c) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
return padStart((CharSequence) str, i, c).toString();
|
|
}
|
|
|
|
public static final IntRange getIndices(CharSequence charSequence) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
return new IntRange(0, charSequence.length() - 1);
|
|
}
|
|
|
|
public static final int getLastIndex(CharSequence charSequence) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
return charSequence.length() - 1;
|
|
}
|
|
|
|
public static final String substring(CharSequence charSequence, IntRange range) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(range, "range");
|
|
return charSequence.subSequence(range.getStart().intValue(), range.getEndInclusive().intValue() + 1).toString();
|
|
}
|
|
|
|
public static /* synthetic */ String substringBefore$default(String str, char c, String str2, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str2 = str;
|
|
}
|
|
return substringBefore(str, c, str2);
|
|
}
|
|
|
|
public static final String substringBefore(String str, char c, String missingDelimiterValue) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(missingDelimiterValue, "missingDelimiterValue");
|
|
int indexOf$default = indexOf$default((CharSequence) str, c, 0, false, 6, (Object) null);
|
|
if (indexOf$default == -1) {
|
|
return missingDelimiterValue;
|
|
}
|
|
String substring = str.substring(0, indexOf$default);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static /* synthetic */ String substringBefore$default(String str, String str2, String str3, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str3 = str;
|
|
}
|
|
return substringBefore(str, str2, str3);
|
|
}
|
|
|
|
public static final String substringBefore(String str, String delimiter, String missingDelimiterValue) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(delimiter, "delimiter");
|
|
Intrinsics.checkNotNullParameter(missingDelimiterValue, "missingDelimiterValue");
|
|
int indexOf$default = indexOf$default((CharSequence) str, delimiter, 0, false, 6, (Object) null);
|
|
if (indexOf$default == -1) {
|
|
return missingDelimiterValue;
|
|
}
|
|
String substring = str.substring(0, indexOf$default);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static /* synthetic */ String substringAfter$default(String str, char c, String str2, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str2 = str;
|
|
}
|
|
return substringAfter(str, c, str2);
|
|
}
|
|
|
|
public static final String substringAfter(String str, char c, String missingDelimiterValue) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(missingDelimiterValue, "missingDelimiterValue");
|
|
int indexOf$default = indexOf$default((CharSequence) str, c, 0, false, 6, (Object) null);
|
|
if (indexOf$default == -1) {
|
|
return missingDelimiterValue;
|
|
}
|
|
String substring = str.substring(indexOf$default + 1, str.length());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static /* synthetic */ String substringAfter$default(String str, String str2, String str3, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str3 = str;
|
|
}
|
|
return substringAfter(str, str2, str3);
|
|
}
|
|
|
|
public static final String substringAfter(String str, String delimiter, String missingDelimiterValue) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(delimiter, "delimiter");
|
|
Intrinsics.checkNotNullParameter(missingDelimiterValue, "missingDelimiterValue");
|
|
int indexOf$default = indexOf$default((CharSequence) str, delimiter, 0, false, 6, (Object) null);
|
|
if (indexOf$default == -1) {
|
|
return missingDelimiterValue;
|
|
}
|
|
String substring = str.substring(indexOf$default + delimiter.length(), str.length());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static /* synthetic */ String substringBeforeLast$default(String str, String str2, String str3, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str3 = str;
|
|
}
|
|
return substringBeforeLast(str, str2, str3);
|
|
}
|
|
|
|
public static final String substringBeforeLast(String str, String delimiter, String missingDelimiterValue) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(delimiter, "delimiter");
|
|
Intrinsics.checkNotNullParameter(missingDelimiterValue, "missingDelimiterValue");
|
|
int lastIndexOf$default = lastIndexOf$default((CharSequence) str, delimiter, 0, false, 6, (Object) null);
|
|
if (lastIndexOf$default == -1) {
|
|
return missingDelimiterValue;
|
|
}
|
|
String substring = str.substring(0, lastIndexOf$default);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static /* synthetic */ String substringAfterLast$default(String str, char c, String str2, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str2 = str;
|
|
}
|
|
return substringAfterLast(str, c, str2);
|
|
}
|
|
|
|
public static String substringAfterLast(String str, char c, String missingDelimiterValue) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(missingDelimiterValue, "missingDelimiterValue");
|
|
int lastIndexOf$default = lastIndexOf$default((CharSequence) str, c, 0, false, 6, (Object) null);
|
|
if (lastIndexOf$default == -1) {
|
|
return missingDelimiterValue;
|
|
}
|
|
String substring = str.substring(lastIndexOf$default + 1, str.length());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static /* synthetic */ String substringAfterLast$default(String str, String str2, String str3, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
str3 = str;
|
|
}
|
|
return substringAfterLast(str, str2, str3);
|
|
}
|
|
|
|
public static final String substringAfterLast(String str, String delimiter, String missingDelimiterValue) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(delimiter, "delimiter");
|
|
Intrinsics.checkNotNullParameter(missingDelimiterValue, "missingDelimiterValue");
|
|
int lastIndexOf$default = lastIndexOf$default((CharSequence) str, delimiter, 0, false, 6, (Object) null);
|
|
if (lastIndexOf$default == -1) {
|
|
return missingDelimiterValue;
|
|
}
|
|
String substring = str.substring(lastIndexOf$default + delimiter.length(), str.length());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static String removePrefix(String str, CharSequence prefix) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(prefix, "prefix");
|
|
if (!startsWith$default((CharSequence) str, prefix, false, 2, (Object) null)) {
|
|
return str;
|
|
}
|
|
String substring = str.substring(prefix.length());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static String removeSuffix(String str, CharSequence suffix) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(suffix, "suffix");
|
|
if (!endsWith$default((CharSequence) str, suffix, false, 2, (Object) null)) {
|
|
return str;
|
|
}
|
|
String substring = str.substring(0, str.length() - suffix.length());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static final boolean regionMatchesImpl(CharSequence charSequence, int i, CharSequence other, int i2, int i3, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(other, "other");
|
|
if (i2 < 0 || i < 0 || i > charSequence.length() - i3 || i2 > other.length() - i3) {
|
|
return false;
|
|
}
|
|
for (int i4 = 0; i4 < i3; i4++) {
|
|
if (!CharsKt__CharKt.equals(charSequence.charAt(i + i4), other.charAt(i2 + i4), z)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static /* synthetic */ boolean endsWith$default(CharSequence charSequence, char c, boolean z, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
z = false;
|
|
}
|
|
return endsWith(charSequence, c, z);
|
|
}
|
|
|
|
public static final boolean endsWith(CharSequence charSequence, char c, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
return charSequence.length() > 0 && CharsKt__CharKt.equals(charSequence.charAt(getLastIndex(charSequence)), c, z);
|
|
}
|
|
|
|
public static /* synthetic */ boolean startsWith$default(CharSequence charSequence, CharSequence charSequence2, boolean z, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
z = false;
|
|
}
|
|
return startsWith(charSequence, charSequence2, z);
|
|
}
|
|
|
|
public static final boolean startsWith(CharSequence charSequence, CharSequence prefix, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(prefix, "prefix");
|
|
if (!z && (charSequence instanceof String) && (prefix instanceof String)) {
|
|
return StringsKt__StringsJVMKt.startsWith$default((String) charSequence, (String) prefix, false, 2, null);
|
|
}
|
|
return regionMatchesImpl(charSequence, 0, prefix, 0, prefix.length(), z);
|
|
}
|
|
|
|
public static /* synthetic */ boolean endsWith$default(CharSequence charSequence, CharSequence charSequence2, boolean z, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
z = false;
|
|
}
|
|
return endsWith(charSequence, charSequence2, z);
|
|
}
|
|
|
|
public static final boolean endsWith(CharSequence charSequence, CharSequence suffix, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(suffix, "suffix");
|
|
if (!z && (charSequence instanceof String) && (suffix instanceof String)) {
|
|
return StringsKt__StringsJVMKt.endsWith$default((String) charSequence, (String) suffix, false, 2, null);
|
|
}
|
|
return regionMatchesImpl(charSequence, charSequence.length() - suffix.length(), suffix, 0, suffix.length(), z);
|
|
}
|
|
|
|
public static final int indexOfAny(CharSequence charSequence, char[] chars, int i, boolean z) {
|
|
int coerceAtLeast;
|
|
char single;
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(chars, "chars");
|
|
if (!z && chars.length == 1 && (charSequence instanceof String)) {
|
|
single = ArraysKt___ArraysKt.single(chars);
|
|
return ((String) charSequence).indexOf(single, i);
|
|
}
|
|
coerceAtLeast = RangesKt___RangesKt.coerceAtLeast(i, 0);
|
|
IntIterator it = new IntRange(coerceAtLeast, getLastIndex(charSequence)).iterator();
|
|
while (it.hasNext()) {
|
|
int nextInt = it.nextInt();
|
|
char charAt = charSequence.charAt(nextInt);
|
|
for (char c : chars) {
|
|
if (CharsKt__CharKt.equals(c, charAt, z)) {
|
|
return nextInt;
|
|
}
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public static final int lastIndexOfAny(CharSequence charSequence, char[] chars, int i, boolean z) {
|
|
int coerceAtMost;
|
|
char single;
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(chars, "chars");
|
|
if (!z && chars.length == 1 && (charSequence instanceof String)) {
|
|
single = ArraysKt___ArraysKt.single(chars);
|
|
return ((String) charSequence).lastIndexOf(single, i);
|
|
}
|
|
for (coerceAtMost = RangesKt___RangesKt.coerceAtMost(i, getLastIndex(charSequence)); -1 < coerceAtMost; coerceAtMost--) {
|
|
char charAt = charSequence.charAt(coerceAtMost);
|
|
for (char c : chars) {
|
|
if (CharsKt__CharKt.equals(c, charAt, z)) {
|
|
return coerceAtMost;
|
|
}
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public static /* synthetic */ int indexOf$StringsKt__StringsKt$default(CharSequence charSequence, CharSequence charSequence2, int i, int i2, boolean z, boolean z2, int i3, Object obj) {
|
|
if ((i3 & 16) != 0) {
|
|
z2 = false;
|
|
}
|
|
return indexOf$StringsKt__StringsKt(charSequence, charSequence2, i, i2, z, z2);
|
|
}
|
|
|
|
public static final int indexOf$StringsKt__StringsKt(CharSequence charSequence, CharSequence charSequence2, int i, int i2, boolean z, boolean z2) {
|
|
int coerceAtMost;
|
|
int coerceAtLeast;
|
|
IntProgression downTo;
|
|
int coerceAtLeast2;
|
|
int coerceAtMost2;
|
|
if (!z2) {
|
|
coerceAtLeast2 = RangesKt___RangesKt.coerceAtLeast(i, 0);
|
|
coerceAtMost2 = RangesKt___RangesKt.coerceAtMost(i2, charSequence.length());
|
|
downTo = new IntRange(coerceAtLeast2, coerceAtMost2);
|
|
} else {
|
|
coerceAtMost = RangesKt___RangesKt.coerceAtMost(i, getLastIndex(charSequence));
|
|
coerceAtLeast = RangesKt___RangesKt.coerceAtLeast(i2, 0);
|
|
downTo = RangesKt___RangesKt.downTo(coerceAtMost, coerceAtLeast);
|
|
}
|
|
if ((charSequence instanceof String) && (charSequence2 instanceof String)) {
|
|
int first = downTo.getFirst();
|
|
int last = downTo.getLast();
|
|
int step = downTo.getStep();
|
|
if ((step <= 0 || first > last) && (step >= 0 || last > first)) {
|
|
return -1;
|
|
}
|
|
while (!StringsKt__StringsJVMKt.regionMatches((String) charSequence2, 0, (String) charSequence, first, charSequence2.length(), z)) {
|
|
if (first == last) {
|
|
return -1;
|
|
}
|
|
first += step;
|
|
}
|
|
return first;
|
|
}
|
|
int first2 = downTo.getFirst();
|
|
int last2 = downTo.getLast();
|
|
int step2 = downTo.getStep();
|
|
if ((step2 <= 0 || first2 > last2) && (step2 >= 0 || last2 > first2)) {
|
|
return -1;
|
|
}
|
|
while (!regionMatchesImpl(charSequence2, 0, charSequence, first2, charSequence2.length(), z)) {
|
|
if (first2 == last2) {
|
|
return -1;
|
|
}
|
|
first2 += step2;
|
|
}
|
|
return first2;
|
|
}
|
|
|
|
public static final Pair findAnyOf$StringsKt__StringsKt(CharSequence charSequence, Collection collection, int i, boolean z, boolean z2) {
|
|
int coerceAtMost;
|
|
IntProgression downTo;
|
|
Object obj;
|
|
Object obj2;
|
|
int coerceAtLeast;
|
|
if (!z && collection.size() == 1) {
|
|
String str = (String) CollectionsKt___CollectionsKt.single(collection);
|
|
int indexOf$default = !z2 ? indexOf$default(charSequence, str, i, false, 4, (Object) null) : lastIndexOf$default(charSequence, str, i, false, 4, (Object) null);
|
|
if (indexOf$default < 0) {
|
|
return null;
|
|
}
|
|
return TuplesKt.to(Integer.valueOf(indexOf$default), str);
|
|
}
|
|
if (z2) {
|
|
coerceAtMost = RangesKt___RangesKt.coerceAtMost(i, getLastIndex(charSequence));
|
|
downTo = RangesKt___RangesKt.downTo(coerceAtMost, 0);
|
|
} else {
|
|
coerceAtLeast = RangesKt___RangesKt.coerceAtLeast(i, 0);
|
|
downTo = new IntRange(coerceAtLeast, charSequence.length());
|
|
}
|
|
if (charSequence instanceof String) {
|
|
int first = downTo.getFirst();
|
|
int last = downTo.getLast();
|
|
int step = downTo.getStep();
|
|
if ((step > 0 && first <= last) || (step < 0 && last <= first)) {
|
|
while (true) {
|
|
Iterator it = collection.iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
obj2 = null;
|
|
break;
|
|
}
|
|
obj2 = it.next();
|
|
String str2 = (String) obj2;
|
|
if (StringsKt__StringsJVMKt.regionMatches(str2, 0, (String) charSequence, first, str2.length(), z)) {
|
|
break;
|
|
}
|
|
}
|
|
String str3 = (String) obj2;
|
|
if (str3 == null) {
|
|
if (first == last) {
|
|
break;
|
|
}
|
|
first += step;
|
|
} else {
|
|
return TuplesKt.to(Integer.valueOf(first), str3);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
int first2 = downTo.getFirst();
|
|
int last2 = downTo.getLast();
|
|
int step2 = downTo.getStep();
|
|
if ((step2 > 0 && first2 <= last2) || (step2 < 0 && last2 <= first2)) {
|
|
while (true) {
|
|
Iterator it2 = collection.iterator();
|
|
while (true) {
|
|
if (!it2.hasNext()) {
|
|
obj = null;
|
|
break;
|
|
}
|
|
obj = it2.next();
|
|
String str4 = (String) obj;
|
|
if (regionMatchesImpl(str4, 0, charSequence, first2, str4.length(), z)) {
|
|
break;
|
|
}
|
|
}
|
|
String str5 = (String) obj;
|
|
if (str5 == null) {
|
|
if (first2 == last2) {
|
|
break;
|
|
}
|
|
first2 += step2;
|
|
} else {
|
|
return TuplesKt.to(Integer.valueOf(first2), str5);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static /* synthetic */ int indexOf$default(CharSequence charSequence, char c, int i, boolean z, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
z = false;
|
|
}
|
|
return indexOf(charSequence, c, i, z);
|
|
}
|
|
|
|
public static final int indexOf(CharSequence charSequence, char c, int i, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
if (z || !(charSequence instanceof String)) {
|
|
return indexOfAny(charSequence, new char[]{c}, i, z);
|
|
}
|
|
return ((String) charSequence).indexOf(c, i);
|
|
}
|
|
|
|
public static /* synthetic */ int indexOf$default(CharSequence charSequence, String str, int i, boolean z, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
z = false;
|
|
}
|
|
return indexOf(charSequence, str, i, z);
|
|
}
|
|
|
|
public static final int indexOf(CharSequence charSequence, String string, int i, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(string, "string");
|
|
if (z || !(charSequence instanceof String)) {
|
|
return indexOf$StringsKt__StringsKt$default(charSequence, string, i, charSequence.length(), z, false, 16, null);
|
|
}
|
|
return ((String) charSequence).indexOf(string, i);
|
|
}
|
|
|
|
public static /* synthetic */ int lastIndexOf$default(CharSequence charSequence, char c, int i, boolean z, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
i = getLastIndex(charSequence);
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
z = false;
|
|
}
|
|
return lastIndexOf(charSequence, c, i, z);
|
|
}
|
|
|
|
public static final int lastIndexOf(CharSequence charSequence, char c, int i, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
if (z || !(charSequence instanceof String)) {
|
|
return lastIndexOfAny(charSequence, new char[]{c}, i, z);
|
|
}
|
|
return ((String) charSequence).lastIndexOf(c, i);
|
|
}
|
|
|
|
public static /* synthetic */ int lastIndexOf$default(CharSequence charSequence, String str, int i, boolean z, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
i = getLastIndex(charSequence);
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
z = false;
|
|
}
|
|
return lastIndexOf(charSequence, str, i, z);
|
|
}
|
|
|
|
public static final int lastIndexOf(CharSequence charSequence, String string, int i, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(string, "string");
|
|
if (z || !(charSequence instanceof String)) {
|
|
return indexOf$StringsKt__StringsKt(charSequence, string, i, 0, z, true);
|
|
}
|
|
return ((String) charSequence).lastIndexOf(string, i);
|
|
}
|
|
|
|
public static /* synthetic */ boolean contains$default(CharSequence charSequence, CharSequence charSequence2, boolean z, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
z = false;
|
|
}
|
|
return contains(charSequence, charSequence2, z);
|
|
}
|
|
|
|
public static boolean contains(CharSequence charSequence, CharSequence other, boolean z) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(other, "other");
|
|
if (other instanceof String) {
|
|
if (indexOf$default(charSequence, (String) other, 0, z, 2, (Object) null) < 0) {
|
|
return false;
|
|
}
|
|
} else if (indexOf$StringsKt__StringsKt$default(charSequence, other, 0, charSequence.length(), z, false, 16, null) < 0) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static /* synthetic */ Sequence rangesDelimitedBy$StringsKt__StringsKt$default(CharSequence charSequence, char[] cArr, int i, boolean z, int i2, int i3, Object obj) {
|
|
if ((i3 & 2) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
z = false;
|
|
}
|
|
if ((i3 & 8) != 0) {
|
|
i2 = 0;
|
|
}
|
|
return rangesDelimitedBy$StringsKt__StringsKt(charSequence, cArr, i, z, i2);
|
|
}
|
|
|
|
public static final Sequence rangesDelimitedBy$StringsKt__StringsKt(CharSequence charSequence, final char[] cArr, int i, final boolean z, int i2) {
|
|
requireNonNegativeLimit(i2);
|
|
return new DelimitedRangesSequence(charSequence, i, i2, new Function2() { // from class: kotlin.text.StringsKt__StringsKt$rangesDelimitedBy$1
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(2);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function2
|
|
public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
|
|
return invoke((CharSequence) obj, ((Number) obj2).intValue());
|
|
}
|
|
|
|
public final Pair invoke(CharSequence $receiver, int i3) {
|
|
Intrinsics.checkNotNullParameter($receiver, "$this$$receiver");
|
|
int indexOfAny = StringsKt__StringsKt.indexOfAny($receiver, cArr, i3, z);
|
|
if (indexOfAny < 0) {
|
|
return null;
|
|
}
|
|
return TuplesKt.to(Integer.valueOf(indexOfAny), 1);
|
|
}
|
|
});
|
|
}
|
|
|
|
public static /* synthetic */ Sequence rangesDelimitedBy$StringsKt__StringsKt$default(CharSequence charSequence, String[] strArr, int i, boolean z, int i2, int i3, Object obj) {
|
|
if ((i3 & 2) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
z = false;
|
|
}
|
|
if ((i3 & 8) != 0) {
|
|
i2 = 0;
|
|
}
|
|
return rangesDelimitedBy$StringsKt__StringsKt(charSequence, strArr, i, z, i2);
|
|
}
|
|
|
|
public static final Sequence rangesDelimitedBy$StringsKt__StringsKt(CharSequence charSequence, String[] strArr, int i, final boolean z, int i2) {
|
|
final List asList;
|
|
requireNonNegativeLimit(i2);
|
|
asList = ArraysKt___ArraysJvmKt.asList(strArr);
|
|
return new DelimitedRangesSequence(charSequence, i, i2, new Function2() { // from class: kotlin.text.StringsKt__StringsKt$rangesDelimitedBy$2
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(2);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function2
|
|
public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
|
|
return invoke((CharSequence) obj, ((Number) obj2).intValue());
|
|
}
|
|
|
|
public final Pair invoke(CharSequence $receiver, int i3) {
|
|
Pair findAnyOf$StringsKt__StringsKt;
|
|
Intrinsics.checkNotNullParameter($receiver, "$this$$receiver");
|
|
findAnyOf$StringsKt__StringsKt = StringsKt__StringsKt.findAnyOf$StringsKt__StringsKt($receiver, asList, i3, z, false);
|
|
if (findAnyOf$StringsKt__StringsKt != null) {
|
|
return TuplesKt.to(findAnyOf$StringsKt__StringsKt.getFirst(), Integer.valueOf(((String) findAnyOf$StringsKt__StringsKt.getSecond()).length()));
|
|
}
|
|
return null;
|
|
}
|
|
});
|
|
}
|
|
|
|
public static final void requireNonNegativeLimit(int i) {
|
|
if (i >= 0) {
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException(("Limit must be non-negative, but was " + i).toString());
|
|
}
|
|
|
|
public static /* synthetic */ Sequence splitToSequence$default(CharSequence charSequence, String[] strArr, boolean z, int i, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
z = false;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
i = 0;
|
|
}
|
|
return splitToSequence(charSequence, strArr, z, i);
|
|
}
|
|
|
|
public static final Sequence splitToSequence(final CharSequence charSequence, String[] delimiters, boolean z, int i) {
|
|
Sequence map;
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(delimiters, "delimiters");
|
|
map = SequencesKt___SequencesKt.map(rangesDelimitedBy$StringsKt__StringsKt$default(charSequence, delimiters, 0, z, i, 2, (Object) null), new Function1() { // from class: kotlin.text.StringsKt__StringsKt$splitToSequence$1
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(1);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public final String invoke(IntRange it) {
|
|
Intrinsics.checkNotNullParameter(it, "it");
|
|
return StringsKt__StringsKt.substring(charSequence, it);
|
|
}
|
|
});
|
|
return map;
|
|
}
|
|
|
|
public static /* synthetic */ List split$default(CharSequence charSequence, String[] strArr, boolean z, int i, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
z = false;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
i = 0;
|
|
}
|
|
return split(charSequence, strArr, z, i);
|
|
}
|
|
|
|
public static final List split(CharSequence charSequence, String[] delimiters, boolean z, int i) {
|
|
Iterable asIterable;
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(delimiters, "delimiters");
|
|
if (delimiters.length == 1) {
|
|
String str = delimiters[0];
|
|
if (str.length() != 0) {
|
|
return split$StringsKt__StringsKt(charSequence, str, z, i);
|
|
}
|
|
}
|
|
asIterable = SequencesKt___SequencesKt.asIterable(rangesDelimitedBy$StringsKt__StringsKt$default(charSequence, delimiters, 0, z, i, 2, (Object) null));
|
|
ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(asIterable, 10));
|
|
Iterator it = asIterable.iterator();
|
|
while (it.hasNext()) {
|
|
arrayList.add(substring(charSequence, (IntRange) it.next()));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public static /* synthetic */ List split$default(CharSequence charSequence, char[] cArr, boolean z, int i, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
z = false;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
i = 0;
|
|
}
|
|
return split(charSequence, cArr, z, i);
|
|
}
|
|
|
|
public static final List split(CharSequence charSequence, char[] delimiters, boolean z, int i) {
|
|
Iterable asIterable;
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
Intrinsics.checkNotNullParameter(delimiters, "delimiters");
|
|
if (delimiters.length == 1) {
|
|
return split$StringsKt__StringsKt(charSequence, String.valueOf(delimiters[0]), z, i);
|
|
}
|
|
asIterable = SequencesKt___SequencesKt.asIterable(rangesDelimitedBy$StringsKt__StringsKt$default(charSequence, delimiters, 0, z, i, 2, (Object) null));
|
|
ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(asIterable, 10));
|
|
Iterator it = asIterable.iterator();
|
|
while (it.hasNext()) {
|
|
arrayList.add(substring(charSequence, (IntRange) it.next()));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public static final List split$StringsKt__StringsKt(CharSequence charSequence, String str, boolean z, int i) {
|
|
requireNonNegativeLimit(i);
|
|
int i2 = 0;
|
|
int indexOf = indexOf(charSequence, str, 0, z);
|
|
if (indexOf == -1 || i == 1) {
|
|
return CollectionsKt__CollectionsJVMKt.listOf(charSequence.toString());
|
|
}
|
|
boolean z2 = i > 0;
|
|
ArrayList arrayList = new ArrayList(z2 ? RangesKt___RangesKt.coerceAtMost(i, 10) : 10);
|
|
do {
|
|
arrayList.add(charSequence.subSequence(i2, indexOf).toString());
|
|
i2 = str.length() + indexOf;
|
|
if (z2 && arrayList.size() == i - 1) {
|
|
break;
|
|
}
|
|
indexOf = indexOf(charSequence, str, i2, z);
|
|
} while (indexOf != -1);
|
|
arrayList.add(charSequence.subSequence(i2, charSequence.length()).toString());
|
|
return arrayList;
|
|
}
|
|
|
|
public static Sequence lineSequence(CharSequence charSequence) {
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
return splitToSequence$default(charSequence, new String[]{"\r\n", "\n", "\r"}, false, 0, 6, null);
|
|
}
|
|
|
|
public static final List lines(CharSequence charSequence) {
|
|
List list;
|
|
Intrinsics.checkNotNullParameter(charSequence, "<this>");
|
|
list = SequencesKt___SequencesKt.toList(lineSequence(charSequence));
|
|
return list;
|
|
}
|
|
}
|