Package java.text

Examples of java.text.CollationElementIterator


     * @param s2 the contained string
     * @return the part of s1 that precedes the first occurrence of s2
     */

    public String substringBefore(String s1, String s2) {
        CollationElementIterator iter1 = collator.getCollationElementIterator(s1);
        CollationElementIterator iter2 = collator.getCollationElementIterator(s2);
        int[] ib = new int[2];
        boolean bb = collationContains(iter1, iter2, ib, false);
        if (bb) {
            return s1.substring(0, ib[0]);
        } else {
View Full Code Here


    public static void main(String[] args) {
        Configuration config = new Configuration();
        StringCollator collator = StandardCollationURIResolver.getInstance().resolve(args[0], args[0], config);
        FastStringBuffer sb = new FastStringBuffer(100);
        if (collator instanceof RuleBasedCollator) {
            CollationElementIterator iter = ((RuleBasedCollator)collator).getCollationElementIterator(args[1]);
            while (true) {
                int e = iter.next();
                if (e==-1) {
                    break;
                }
                sb.append(e+" ");
            }
View Full Code Here

    }

    Boolean result;

    // get the collation integer representing "_"
    CollationElementIterator cei =
                  collator.getCollationElementIterator("_");
    anyCharInts[0] = cei.next();
    {
      int nextInt;

      // There may be multiple ints representing this character
      while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
      {
        int[] temp = new int[anyCharInts.length + 1];
        for (int index = 0; index < anyCharInts.length; index++)
        {
          temp[index] = anyCharInts[index];
        }
        temp[anyCharInts.length] = nextInt;
        anyCharInts = temp;
      }
    }
    // get the collation integer representing "%"
    cei = collator.getCollationElementIterator("%");
    anyStringInts[0] = cei.next();
    {
      int nextInt;

      // There may be multiple ints representing this character
      while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
      {
        int[] temp = new int[anyStringInts.length + 1];
        for (int index = 0; index < anyStringInts.length; index++)
        {
          temp[index] = anyStringInts[index];
View Full Code Here

TOP

Related Classes of java.text.CollationElementIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.