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

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

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