All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cflint.tools.CommentReformatting Maven / Gradle / Ivy

Go to download

A static code analysis tool for ColdFusion (in the spirit of FindBugs and Lint). With CFLint, you are able to analyze your ColdFusion code base for code violations.

There is a newer version: 1.5.0
Show newest version
package com.cflint.tools;

import java.util.Stack;

public class CommentReformatting {

    public static String wrap(String value) {
        Stack stack = new Stack<>();
        StringBuilder sb = new StringBuilder(value);
        int pos = sb.indexOf(COMMENT_TEXT);
        while (pos >= 0) {
            int endpos = sb.indexOf(COMMENT_END_TEXT, pos);
            int nextpos = sb.indexOf(COMMENT_TEXT, pos + 1);
            if ((endpos > 0 && endpos < nextpos) || nextpos < 0) {
                if (!stack.isEmpty()) {
                    sb.replace(endpos, endpos + 4, "-->");
                    sb.replace(pos, pos + 5, "";
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy