@Immutable
    public static int levenshtein(String s1, String s2, int cost_ins, int cost_rep, int cost_del) {
        int i, j, flip, ii, ii2, cost;
        int l1 = s1.length();
        int l2 = s2.length();

        if (l1 > 255)
            return -1;
        if (l2 > 255)
            return -1;

        int cr = cost_rep;
        int ci = cost_ins;
        int cd = cost_del;

        int cutHalf = flip = Math.max(l1, l2);

        int minCost = Math.min(Math.min(cd, ci), cr);

        int minD = Math.max(minCost, (l1 - l2) * cd);
        int minI = Math.max(minCost, (l2 - l1) * ci);

        int[] buf = new int[(cutHalf * 2) + 1];
        for (i = 0; i <= l2; ++i) {
            buf[i] = i * minD;
        }

        for (i = 0; i < l1; ++i, flip = cutHalf - flip) {
            char ch = s1.charAt(i);
            buf[flip] = (i + 1) * minI;

            ii = flip;
            ii2 = cutHalf - flip;

            for (j = 0; j < l2; ++j, ++ii, ++ii2) {
                cost = (ch == s2.charAt(j) ? 0 : cr);
                buf[ii + 1] = Math.min(Math.min(buf[ii2 + 1] + cd, buf[ii] + ci), buf[ii2] + cost);
            }
        }
        return buf[l2 + cutHalf - flip];
    }
Parses the cslashes bitmap returning an actual bitmap.

@param charset the bitmap string

@return the actual bitmap
exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/StringFunctions.java