Check Equality for two strings with Collator : Collator « I18N « Java






Check Equality for two strings with Collator

 

import java.text.Collator;
import java.util.Locale;

public class Main {
  public static void main(String args[]) {
    String s1 = "";
    String s2 = "";

    Collator frCollator = Collator.getInstance(Locale.FRANCE);
    frCollator.setStrength(Collator.SECONDARY);
    if (frCollator.compare(s1, s2) == 0) {
      System.out.println("s1 = s2");
    }
  }
}
//s1 = s2

   
  








Related examples in the same category

1.Collator.getInstance(new Locale("sv", ""))
2.Comparing Half-Width and full-width A
3.Collator.NO_DECOMPOSITION
4.Collator.CANONICAL_DECOMPOSITION
5.Collator.FULL_DECOMPOSITION
6.Sort Collate
7.I18N SortI18N Sort
8.Searching, Sorting, and Text Boundary Detection: Collation IssuesSearching, Sorting, and Text Boundary Detection: Collation Issues
9.Compare accentuated letters
10.Sort strings using Collator class
11.I18N : TextI18N : Text