All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.refactoringminer.util.PrefixSuffixUtils Maven / Gradle / Ivy

Go to download

RefactoringMiner is a library/API written in Java that can detect refactorings applied in the history of a Java project.

There is a newer version: 3.0.9
Show newest version
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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy