Collator class is used for the comparison of local sensitive strings. This tip will show the sample code to show the way to use Collator class.
import java.text.Collator;
import java.util.Locale;
public class CollatorExp {
public static void main(String[] args) {
Collator collator = Collator.getInstance(Locale.GERMAN);
if (collator.compare("gutten", "hilfe") == 0) {
System.out.println("Both Strings are equal");
} else {
System.out.println("Both Strings are not equal");
}
}
}