Collator Compare1() Example

Compares the source string to the target string according to the collation rules for this Collator.


Collatorclass Compare1() method example. This example shows you how to use Compare1() method.This method Compares the source string to the target string according to the collation rules for this Collator.

Here is the code:-
/* 
 * @Program that Compares the source string to the target string according to 
    the collation rules for this Collator.
 * Compare1.java 
 * Author:-RoseIndia Team
 * Date:-16-Jun-2008
 */

import java.util.*;
import java.text.*;
public class Compare1 {
public static void main(String[] args) {
Collator collate = Collator.getInstance();
        String s1="jhfdkjk";
        String s2="jhfdkjklrejf";
        //Compares the source string to the target string
        int i=collate.compare(s2, s1);
        System.out.println(i);
    }

}

Output of the program:-
 1

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US