Package br.msf.commons.lang

Examples of br.msf.commons.lang.EnhancedStringBuilder.charAt()


                                                  final int maxLineLengh) {
        assert CharSequenceUtils.isNotBlank(text) && CharSequenceUtils.isNotBlank(commentStart) && CharSequenceUtils.isNotBlank(commentEnd);
        final EnhancedStringBuilder builder = new EnhancedStringBuilder(text).deletePattern("\r");
        final Collection<MatchEntry> newLines = builder.findPattern("\n");
        for (MatchEntry match : newLines) {
            if (match.getStart() > 0 && isPeriodFinalization(builder.charAt(match.getStart() - 1))
                && '\n' != builder.charAt(match.getStart() + 1)) {
                /* new lines not after a punctuation are removed */
                builder.replace(match, " ");
            }
        }
View Full Code Here


        assert CharSequenceUtils.isNotBlank(text) && CharSequenceUtils.isNotBlank(commentStart) && CharSequenceUtils.isNotBlank(commentEnd);
        final EnhancedStringBuilder builder = new EnhancedStringBuilder(text).deletePattern("\r");
        final Collection<MatchEntry> newLines = builder.findPattern("\n");
        for (MatchEntry match : newLines) {
            if (match.getStart() > 0 && isPeriodFinalization(builder.charAt(match.getStart() - 1))
                && '\n' != builder.charAt(match.getStart() + 1)) {
                /* new lines not after a punctuation are removed */
                builder.replace(match, " ");
            }
        }
        builder.replacePattern(" +", " ");
View Full Code Here

        while (builder.length() > maxLenght) {
            int mark = -1;
            // here we look for the last ' ' occurrence before the MAX_LINE_LEN
            // or the first one if there is no ' ' before reaching the MAX_LINE_LEN limit
            for (int i = 0; i < builder.length(); i++) {
                if (builder.charAt(i) == ' ') {
                    if (i <= maxLenght || mark == -1) {
                        mark = i;
                    } else if (i > maxLenght) {
                        break;
                    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.