mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-05 16:24:29 +02:00
Now one non positional substitution and one positional is detected as "multiple non positional".
This commit is contained in:
parent
14f26474e6
commit
d9cac893f9
@ -137,14 +137,16 @@ public final class ResXmlEncoders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasMultipleNonPositionalSubstitutions(String str) {
|
public static boolean hasMultipleNonPositionalSubstitutions(String str) {
|
||||||
return findSubstitutions(str, 2).m1.size() > 1;
|
Duo<List<Integer>, List<Integer>> tuple = findSubstitutions(str, 2);
|
||||||
|
return ! tuple.m1.isEmpty() && tuple.m1.size() + tuple.m2.size() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String enumerateNonPositionalSubstitutionsIfRequired(String str) {
|
public static String enumerateNonPositionalSubstitutionsIfRequired(String str) {
|
||||||
List<Integer> subs = findSubstitutions(str, -1).m1;
|
Duo<List<Integer>, List<Integer>> tuple = findSubstitutions(str, 2);
|
||||||
if (subs.size() < 2) {
|
if (tuple.m1.isEmpty() || tuple.m1.size() + tuple.m2.size() < 2) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
List<Integer> subs = tuple.m1;
|
||||||
|
|
||||||
StringBuilder out = new StringBuilder();
|
StringBuilder out = new StringBuilder();
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -24,4 +24,5 @@ bar"</string>
|
|||||||
<string name="test_string22" formatted="false">%02d foo %01d</string>
|
<string name="test_string22" formatted="false">%02d foo %01d</string>
|
||||||
<string name="test_string23" formatted="false">%d foo %1</string>
|
<string name="test_string23" formatted="false">%d foo %1</string>
|
||||||
<string name="test_string24" formatted="false">%1% foo %2%</string>
|
<string name="test_string24" formatted="false">%1% foo %2%</string>
|
||||||
|
<string name="test_string25" formatted="false">foo %s bar %2$s baz</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user