@Immutable
    public static String number_format(double number, int decimals, char decPoint, char thousandsSep) {
        String pattern;
        if (decimals > 0) {
            StringBuilder patternBuilder = new StringBuilder(6 + decimals);

            patternBuilder.append(thousandsSep == 0 ? "###0." : "#,##0.");

            for (int i = 0; i < decimals; i++) {
                patternBuilder.append('0');
            }

            pattern = patternBuilder.toString();
        } else {
            pattern = thousandsSep == 0 ? "###0" : "#,##0";
        }

        DecimalFormatSymbols decimalFormatSymbols;

        if (decPoint == '.' && thousandsSep == ',') {
            decimalFormatSymbols = DEFAULT_DECIMAL_FORMAT_SYMBOLS;
        } else {
            decimalFormatSymbols = new DecimalFormatSymbols();
            decimalFormatSymbols.setDecimalSeparator(decPoint);
            decimalFormatSymbols.setGroupingSeparator(thousandsSep);
            decimalFormatSymbols.setZeroDigit('0');
        }

        DecimalFormat format = new DecimalFormat(pattern, decimalFormatSymbols);

        String result = format.format(number);
        if (decPoint == 0 && decimals > 0) {
            // no way to get DecimalFormat to output nothing for the point,
            // so remove it here
            int i = result.lastIndexOf(decPoint);
            return result.substring(0, i) + result.substring(i + 1);
        } else {
            return result;
        }
    }
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