Skip to content

Commit

Permalink
Fixes #626
Browse files Browse the repository at this point in the history
Move StringUtils.removeEndIgnoreCase to StringUtil class
  • Loading branch information
morganteg committed Mar 27, 2023
1 parent ce07ba1 commit edfdcbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/logic/importer/AuthorListParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import java.util.Optional;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.jabref.model.entry.Author;
import org.jabref.model.entry.AuthorList;
import org.jabref.model.strings.StringUtil;

public class AuthorListParser {

Expand Down Expand Up @@ -98,7 +98,7 @@ public AuthorList parse(String listOfNames) {
Objects.requireNonNull(listOfNames);

// Handle the statement "and others" at the end, removing it
listOfNames = StringUtils.removeEndIgnoreCase(listOfNames.trim(), " AND OTHERS");
listOfNames = StringUtil.removeStringAtTheEnd(listOfNames.trim(), " and others");

// Handle case names in order lastname, firstname and separated by ","
// E.g., Ali Babar, M., Dingsøyr, T., Lago, P., van der Vliet, H.
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/model/strings/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -761,4 +761,9 @@ public static String quoteStringIfSpaceIsContained(String string) {
public static boolean containsWhitespace(String s) {
return s.chars().anyMatch(Character::isWhitespace);
}

@ApacheCommonsLang3Allowed("No Guava equivalent existing - see https://stackoverflow.com/a/23825984")
public static String removeStringAtTheEnd(String string, String stringToBeRemoved) {
return StringUtils.removeEndIgnoreCase(string, stringToBeRemoved);
}
}

0 comments on commit edfdcbc

Please sign in to comment.