Code example for Matcher

Methods: find, replaceAll, reset

0
    public static String unfold(String s) {
        if (s == null) {
            return null; 
        } 
        Matcher patternMatcher = PATTERN_CR_OR_LF.matcher(s);
        if (patternMatcher.find()) {
            patternMatcher.reset();
            s = patternMatcher.replaceAll("");
        } 
        return s;
    } 
 
    public static String decode(String s) {
        if (s == null) {
            return null; 
        } 
        return DecoderUtil.decodeEncodedWords(s);
    } 
 
    public static String unfoldAndDecode(String s) {
        return decode(unfold(s));