mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-11-27 06:16:49 +01:00
fix: Use Java instead of Kotlin Regex to improve reliability (#628)
If Kotlin Regex would be used, then apps need to have the Kotlin libraries for Regex to work which isn't always the case.
This commit is contained in:
parent
07fe660037
commit
44c3cc4636
@ -28,6 +28,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import java.text.Bidi;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
@ -36,7 +37,6 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.revanced.integrations.shared.settings.BooleanSetting;
|
||||
import app.revanced.integrations.shared.settings.preference.ReVancedAboutPreference;
|
||||
import kotlin.text.Regex;
|
||||
|
||||
public class Utils {
|
||||
|
||||
@ -474,14 +474,14 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Regex punctuationRegex = new Regex("\\p{P}+");
|
||||
private static final Pattern punctuationPattern = Pattern.compile("\\p{P}+");
|
||||
|
||||
/**
|
||||
* Strips all punctuation and converts to lower case. A null parameter returns an empty string.
|
||||
*/
|
||||
public static String removePunctuationConvertToLowercase(@Nullable CharSequence original) {
|
||||
if (original == null) return "";
|
||||
return punctuationRegex.replace(original, "").toLowerCase();
|
||||
return punctuationPattern.matcher(original).replaceAll("").toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user