Skip to content

Commit

Permalink
Make timeline matching case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
xpdota committed Nov 20, 2024
1 parent aa6c9ac commit 3693402
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import gg.xp.xivsupport.events.actlines.events.NameIdPair;
import org.apache.commons.lang3.StringUtils;

import java.util.Locale;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
Expand Down Expand Up @@ -65,10 +66,12 @@ static <X> CbConversion<X> intConv(Function<X, Long> getter, int base, int minDi

static <X> CbConversion<X> strConv(Function<X, String> getter) {
return str -> {
// Fast path for when the input isn't doing anything regexy and thus can use a simple string match
if (simpleString.matcher(str).matches()) {
return item -> Objects.equals(getter.apply(item), str);
String asUpper = str.toUpperCase(Locale.ROOT);
return item -> Objects.equals(getter.apply(item).toUpperCase(Locale.ROOT), asUpper);
}
Pattern pattern = Pattern.compile(str);
Pattern pattern = Pattern.compile(str, Pattern.CASE_INSENSITIVE);
return item -> pattern.matcher(getter.apply(item)).matches();
};
}
Expand Down

0 comments on commit 3693402

Please sign in to comment.