org.refactoringminer.util.PrefixSuffixUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of refactoring-miner Show documentation
Show all versions of refactoring-miner Show documentation
RefactoringMiner is a library/API written in Java that can detect refactorings applied in the history of a Java project.
package org.refactoringminer.util;
import static gr.uom.java.xmi.Constants.JAVA;
public class PrefixSuffixUtils {
public static String longestCommonPrefix(String s1, String s2) {
int minLength = Math.min(s1.length(), s2.length());
int i = 0;
while (i < minLength && s1.charAt(i) == s2.charAt(i)) {
i++;
}
return s1.substring(0, i);
}
public static String longestCommonSuffix(String s1, String s2) {
int minLength = Math.min(s1.length(), s2.length());
int i = 0;
while (i