List of utility methods to do String Equal
boolean | areStringsEqual(String s1, String s2, boolean caseInsensitive) are Strings Equal if (s1 == null) return s2 == null; if (caseInsensitive) return s1.equalsIgnoreCase(s2); else return s1.equals(s2); |
boolean | areStringsEqual(String s1, String s2, boolean caseInsensitive, boolean dontDistinctNullAndEmpty) are Strings Equal if (dontDistinctNullAndEmpty) { if (s1 == null || s1.length() == 0) return s2 == null || s2.length() == 0; return areStringsEqual(s1, s2, caseInsensitive); |
boolean | areStringsEqual(String str1, String str2) Return whether the 2 passed strings are equal. if (str1 == null && str2 == null) { return true; if (str1 != null) { return str1.equals(str2); return str2.equals(str1); |
String | collapseQualifier(String qualifier, boolean includeDots) Given a qualifier, collapse it. StringTokenizer tokenizer = new StringTokenizer(qualifier, "."); String collapsed = Character.toString(tokenizer.nextToken().charAt(0)); while (tokenizer.hasMoreTokens()) { if (includeDots) { collapsed += '.'; collapsed += tokenizer.nextToken().charAt(0); return collapsed; |
boolean | equalsCaseless(String sA_, String sB_) Compares two strings. String sFirst = sA_.toUpperCase();
String sSecond = sB_.toUpperCase();
return sFirst.equals(sSecond);
|
boolean | equalsIgnoreCase(String s1, String s2) equals Ignore Case return (s1 != null ? s1.equalsIgnoreCase(s2) : s2 == null);
|
boolean | equalsIgnoreCase(String source, String query) equals Ignore Case String parsedQuery = query.replace("f/", "").trim(); List<String> strings = Arrays.asList(source.toLowerCase()); return strings.stream().filter(s -> s.contains(parsedQuery.toLowerCase())).count() > 0; |
boolean | equalsOrExceeds(String version, String threshold) Returns true if the given version is the same or more recent then the threshold version. int versionIndex = knownVersions.indexOf(version); int thresholdIndex = knownVersions.indexOf(threshold); if (versionIndex == -1 || thresholdIndex == -1) { return false; return versionIndex >= thresholdIndex; |
float | getEquality(String str1, String str2) Analyze two strings to determine how much they differ. String lineDelimiter = System.getProperty("line.separator"); StringTokenizer st1 = new StringTokenizer(str1, lineDelimiter); StringTokenizer st2 = new StringTokenizer(str2, lineDelimiter); int linecount1 = 0; int linecount2 = 0; int samecount = 0; int addedcount = 0; int deletedcount = 0; ... |
boolean | isEqual(String str, String str2, boolean isCaseSensitive) is Equal return isNotEmpty(str) && isNotEmpty(str2) ? isCaseSensitive ? str.equals(str2) : str.equalsIgnoreCase(str2)
: false;
|