Android examples for java.lang:String Starts or Ends
find Common Suffix Length for String
import android.text.TextUtils; import java.util.ArrayList; import java.util.List; public class Main{ private static int findCommonSuffixLength(CharSequence str1, CharSequence str2, int commonPrefixLength) { int length = (Math.min(str1.length(), str2.length())); for (int i = 0; i < length - commonPrefixLength; i++) { if (str1.charAt(str1.length() - i - 1) != str2.charAt(str2 .length() - i - 1)) { return i; }/*from ww w.j a v a 2 s .co m*/ } return 0; } }