Java String Collapse collapse(char c)

Here you can find the source of collapse(char c)

Description

collapse

License

Open Source License

Declaration

public static final char collapse(char c) 

Method Source Code

//package com.java2s;

public class Main {
    private static char[] diacritics = new char[0x300];

    public static final char collapse(char c) {
        if (c >= diacritics.length) {
            return c;
        }/*from www.  j  av a  2  s .  c o  m*/
        char tc = diacritics[c];
        return (tc == 0) ? c : tc;
    }

    public static final String collapse(String s) {
        char[] chars = s.toCharArray();

        int count = chars.length;
        for (int i = 0; i < count; ++i) {
            chars[i] = collapse(chars[i]);
        }

        return new String(chars, 0, count);
    }
}

Related

  1. collapse(double[] w)
  2. collapse(float[][] array)
  3. collapse(String str, String characters, String replacement)
  4. collapse(String t)