@Immutable
    public static Memory soundex(String string) {
        int length = string.length();

        if (length == 0)
            return Memory.FALSE;

        StringBuilder sb = new StringBuilder();

        int count = 0;
        char lastCode = 0;

        for (int i = 0; i < length && count < 4; i++) {
            char ch = toUpperCase(string.charAt(i));

            if ('A' <= ch && ch <= 'Z') {
                char code = SOUNDEX_VALUES[ch - 'A'];

                if (count == 0) {
                    sb.append(ch);
                    count++;
                } else if (code != '0' && code != lastCode) {
                    sb.append(code);
                    count++;
                }

                lastCode = code;
            }
        }

        for (; count < 4; count++) {
            sb.append('0');
        }

        return new StringMemory(sb.toString());
    }
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