Android Utililty Methods CharSequence Search

List of utility methods to do CharSequence Search

Description

The list of methods to do CharSequence Search are organized into topic(s).

Method

intfindCommonPrefixLength(CharSequence str1, CharSequence str2)
find Common Prefix Length
int length = (Math.min(str1.length(), str2.length()));
for (int i = 0; i < length; i++) {
    if (str1.charAt(i) != str2.charAt(i)) {
        return i;
return 0;
intfindCommonSuffixLength(CharSequence str1, CharSequence str2, int commonPrefixLength)
find Common Suffix Length
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;
return 0;
...
intindexOfDifference(CharSequence cs1, CharSequence cs2)
index Of Difference
if (cs1 == cs2) {
    return INDEX_NOT_FOUND;
if (cs1 == null || cs2 == null) {
    return 0;
int i;
for (i = 0; i < cs1.length() && i < cs2.length(); ++i) {
...