
cfml.parsing.util.CommentReformatting Maven / Gradle / Ivy
package cfml.parsing.util;
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 - 2025 Weber Informatics LLC | Privacy Policy