compare strings

regionMatches() String Example

regionMatches() used to compare substrings of two strings java.lang.String class comes with many methods to check two strings contain same characters in the same sequence. To do this, String class comes with equals(), equalsIgnoreCase(), compareTo() and compareToIgnoreCase() methods. All the above comparisons are used to compare whole strings. But regionMatches() compares parts of two strings …

regionMatches() String Example Read More »

compareTo() String Example

java.lang.String class comes with many methods to check two strings contain same characters in the same sequence. To do this, String class comes with equals(), compareTo(), equalsIgnoreCase() and compareToIgnoreCase() methods. This tutorial is on compareTo() String. Now we discuss compareTo() String method. Following is the method signature as defined in String class. public int compareTo(String …

compareTo() String Example Read More »