mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Change equals to contains
This commit is contained in:
parent
a380082008
commit
03b3f70ca8
1 changed files with 3 additions and 2 deletions
|
|
@ -53,10 +53,11 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
|
||||||
Calendar now = Calendar.getInstance();
|
Calendar now = Calendar.getInstance();
|
||||||
int year = now.get(Calendar.YEAR);
|
int year = now.get(Calendar.YEAR);
|
||||||
String yearInString = String.valueOf(year);
|
String yearInString = String.valueOf(year);
|
||||||
|
Log.d(TAG, "Year: " + yearInString);
|
||||||
|
|
||||||
int prevYear = year - 1;
|
int prevYear = year - 1;
|
||||||
String prevYearInString = String.valueOf(prevYear);
|
String prevYearInString = String.valueOf(prevYear);
|
||||||
|
Log.d(TAG, "Previous year: " + prevYearInString);
|
||||||
|
|
||||||
//Copy to Iterator to prevent ConcurrentModificationException when removing item
|
//Copy to Iterator to prevent ConcurrentModificationException when removing item
|
||||||
for(iterator = items.iterator(); iterator.hasNext();) {
|
for(iterator = items.iterator(); iterator.hasNext();) {
|
||||||
|
|
@ -64,7 +65,7 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
|
||||||
|
|
||||||
//Check if s contains a 4-digit word anywhere within the string (.* is wildcard)
|
//Check if s contains a 4-digit word anywhere within the string (.* is wildcard)
|
||||||
//And that s does not equal the current year or previous year
|
//And that s does not equal the current year or previous year
|
||||||
if(s.matches(".*(19|20)\\d{2}.*") && !s.equals(yearInString) && !s.equals(prevYearInString)) {
|
if(s.matches(".*(19|20)\\d{2}.*") && !s.contains(yearInString) && !s.contains(prevYearInString)) {
|
||||||
Log.d(TAG, "Filtering out year " + s);
|
Log.d(TAG, "Filtering out year " + s);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue