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

cfml.parsing.util.CommentReformatting Maven / Gradle / Ivy

There is a newer version: 2.11.0
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy