public String truncate(String string, int maxLength)
    {
        if(null == string) return null;
        
        if(_trimFirst)
        {
            string = string.trim();
        }
        
        if(_compressWhiteSpace)
        {
            string = string.replaceAll("\\s{2,}", " ");
        }
        
        if(string.length() <= maxLength)
        {
            return string;
        }
        
        int maxCapture = maxLength - 1 - _suffix.length();
        int minCapture = maxCapture - _breakWordLongerThan;
        if(minCapture < 0 || minCapture >= maxCapture)
        {
            minCapture = 0;
        }
        
        Pattern patt = Pattern.compile(String.format(
            "(?s)^(.{%d,%d}%s)%s.*",
            minCapture,
            maxCapture,
            _wordPattern,
            _wordDelimeterPattern
        ));
        Matcher match = patt.matcher(string);
        if(match.matches())
        {
            return string.substring(0, match.end(1)) + _suffix;
        }
        return string.substring(0, maxLength - _suffix.length()) + _suffix;
    }