Compares two strings (not lexicographically).
180103
@Override
  public int compare(String s1, String s2) {
    if (s1 == s2) { // NOSONAR false-positive: Compare Objects With Equals
      return 0;
    }
    int h1 = s1.hashCode();
    int h2 = s2.hashCode();
    if (h1 < h2) {
      return -1;
    } else if (h1 > h2) {
      return 1;
    } else {
      return s1.compareTo(s2);
    }
  }
1186234
private double compare_(String s1, String s2) {
    // before we begin, note the length of the strings
    int shortlen = Math.min(s1.length(), s2.length());
    int longlen = Math.max(s1.length(), s2.length());
    
    int removed = 0; // total length of common substrings
    while (true) {
      // first, we identify the longest common substring
      int longest = 0;
      int longesti = 0;
      int longestj = 0;
    
      int[][] matrix = new int[s1.length()][s2.length()];
      for (int i = 0; i < s1.length(); i++) {
        for (int j = 0; j < s2.length(); j++) {
          if (s1.charAt(i) == s2.charAt(j)) {
            if (i == 0 || j == 0)
              matrix[i][j] = 1;
            else
              matrix[i][j] = matrix[i - 1][j - 1] + 1;

            if (matrix[i][j] > longest) {
              longest = matrix[i][j];
              longesti = i;
              longestj = j;
            }
          } else
            matrix[i][j] = 0;
        }
      }

      longesti++; // this solves an off-by-one problem
      longestj++; // this solves an off-by-one problem

      // at this point we know the length of the longest common
      // substring, and also its location, since it ends at indexes
      // longesti and longestj.

      if (longest < minlen)
        break; // all remaining common substrings are too short, so we stop

      // now we slice away the common substrings
      s1 = s1.substring(0, longesti - longest) + s1.substring(longesti);
      s2 = s2.substring(0, longestj - longest) + s2.substring(longestj);
      removed += longest;
    }

    return formula.compute(removed, shortlen, longlen);
  }
14269
static public int compare(Name n1, Name n2) {
    int ret = n1.namespaceUri.compareTo(n2.namespaceUri);
    if (ret != 0)
      return ret;
    return n1.localName.compareTo(n2.localName);
  }
566139
public static boolean compare(@Nullable String str1, @Nullable String str2)
  {
    return (str1 == null ? str2 == null : str1.equals(str2));
  }
277258
public static int getMatchNo(String[] strings, String s) {
        for (int i = 0; i < strings.length; i++) {
            if (s.equals(strings[i])) {
                return i;
            }
        }
        return -1;
    }
811829
public int compare(T o1, T o2) {
	if(o1 == o2)   return 0;
	String str1 = (o1 == null) ? "null" : o1.toString(); 
	String str2 = (o2 == null) ? "null" : o2.toString();
	return str1.compareTo(str2);
    }
1167123
public int compareTo(final HttpString other) {
        if(orderInt != 0 && other.orderInt != 0) {
            return signum(orderInt - other.orderInt);
        }
        final int len = Math.min(bytes.length, other.bytes.length);
        int res;
        for (int i = 0; i < len; i++) {
            res = signum(higher(bytes[i]) - higher(other.bytes[i]));
            if (res != 0) return res;
        }
        // shorter strings sort higher
        return signum(bytes.length - other.bytes.length);
    }
1216696
@Override
    public int compare(String o1, String o2) {

        if (o1.equals(o2)) {
            return 0;
        }

        String prefix = Strings.commonPrefix(o1, o2);
        if (prefix.length() == 0) {
            // No common prefix
            return o1.compareTo(o2);
        }

        if (o1.length() == prefix.length()) {
            return -1;
        }

        return o1.compareTo(o2);

    }
1212958
function compareNames(a, b) {
	if (!isArray(a)) a = splitAuthorString(a);
	if (!isArray(b)) b = splitAuthorString(b);

	var aPos = 0, bPos = 0;
	var authorLimit = Math.min(a.length, b.length);
	var failed = false;

	while (aPos < authorLimit && bPos < authorLimit) {
		if (fuzzyStringCompare(a[aPos], b[bPos])) { // Direct or fuzzy matching of entire strings
			aPos++;
			bPos++;
		} else {
			var aAuth = splitAuthor(a[aPos]);
			var bAuth = splitAuthor(b[bPos]);
			var nameLimit = Math.min(aAuth.length, bAuth.length);
			var nameMatches = 0;
			for (var n = 0; n < nameLimit; n++) {
				if (
					aAuth[n] == bAuth[n] || // Direct match
					aAuth[n].length == 1 && bAuth[n].substr(0, 1) || // A is initial and B is full name
					bAuth[n].length == 1 && aAuth[n].substr(0, 1) ||
					(aAuth[n].length > 1 && bAuth[n].length > 1 && fuzzyStringCompare(aAuth[n], bAuth[n], 3))
				) {
					nameMatches++;
				}
			}

			if (nameMatches >= nameLimit) {
				aPos++;
				bPos++;
			} else {
				failed = true;
			}
			break;
		}
	}
	return !failed;
}
1160924
private boolean isMatchingString(String value1, String value2) {
        
        boolean valuesMatch = true;
        
        if (value1 == null) {
            if (value2 != null) {
                valuesMatch = false;
            }
        } else { 
            valuesMatch = value1.equals(value2);
        }
        
        return valuesMatch;
    }
1143828
def ismatch(a,b):
    """"""
    #Try the easy case
    if a == b:
        return True
    else:
        #Try isinstance in both orders
        try:
            if isinstance(a,b):
                return True
        except TypeError:
            try:
                if isinstance(b,a):
                    return True
            except TypeError:
                #Try isinstance(a, type(b)) in both orders
                try:
                    if isinstance(a,type(b)):
                        return True
                except TypeError:
                    try:
                        if isinstance(b,type(a)):
                            return True
                    except TypeError:
                        #Try the string representation
                        if str(a).lower() == str(b).lower():
                            return True
                        else:
                            return False
1345663
function compare(a, b) {
    if (Type.isString(a)) {
        return a === b;
    } else if (Type.isNumber(a)) {
        if (isNaN(a) || isNaN(b)) {
            return isNaN(a) === isNaN(b);
        }
        return a === b;
    } else if (Type.isBoolean(a)) {
        return a === b;
    } else if (Type.isDate(a) && Type.isDate(b)) {
        return a.getTime() === b.getTime();
    } else if (Type.isRegExp(a) && Type.isRegExp(b)) {
        return a.source === b.source;
    } else if (Type.isArray(a) && Type.isArray(b)) {
        // check references first
        if (a === b) {
            return true;
        }
        return a.every(function (item, index) {
            try {
                return compare(item, b[index]);
            } catch (e) {
                throw e;
            }
        });
    } else if (Type.isObject(a) && Type.isObject(b)) {
        var equal = [];
        // check references first
        if (a === b) {
            return true;
        }

        try {
            for (var key in a) {
                equal.push(compare(a[key], b[key]));
            }
        } catch (e) {
            throw e;
        }
        return equal.every(function (item) {
            return item === true;
        });
        /// compare undefined and nulls and nans
    } else if (a === b) {
        return true;
    }

    return false;
}
1307171
@Deprecated
    public static int compare(CharSequence a, CharSequence b) {
        int alength = a.length();
        int blength = b.length();
        int min = alength <= blength ? alength : blength;
        for (int i = 0; i < min; ++i) {
            int diff = a.charAt(i) - b.charAt(i);
            if (diff != 0) {
                return diff;
            }
        }
        return alength - blength;
    }
1236775
def is_equal_strings_ignore_case(first, second):
    """"""
    if first and second:
        return first.upper() == second.upper()
    else:
        return not (first or second)
344567
public static boolean compareStrings(String s1, String s2) {
        if (s1 == s2)
            return true;
        if (s1 != null && s2 != null && s1.equals(s2))
            return true;
        return false;
    }
782681
def _compat_compare_digest(a, b):
    
    if len(a) != len(b):
        return False
    # Computes the bitwise difference of all characters in the two strings
    # before returning whether or not they are equal.
    difference = 0
    for (a_char, b_char) in zip(a, b):
        difference |= ord(a_char) ^ ord(b_char)
    return difference == 0
159234
public int compareTo(OffsetCharSequence other) {
        int len1 = length();
        int len2 = other.length();
        int lim = Math.min(len1, len2);

        for (int i = 0; i  < lim; i++) {
            char c1 = charAt(i);
            char c2 = other.charAt(i);
            if (c1 != c2) {
                return c1 - c2;
            }
        }
        return len1 - len2;
    }