create XML End Tag - Android XML

Android examples for XML:XML Tag

Description

create XML End Tag

Demo Code



public class Main{
    public static void main(String[] argv) throws Exception{
        String parTag = "java2s.com";
        System.out.println(createEndTag(parTag));
    }/*from w  w w.  java 2  s  .  c o  m*/
    public static String createEndTag(String parTag) {
        return createEndTag(0, parTag);
    }
    public static String createEndTag(int parIndent, String parTag) {
        return String.format("%s</%s>\n", indent(parIndent), parTag);
    }
    private static String indent(int parIndent) {
        StringBuilder indentBuilder = new StringBuilder();
        for (int i = 0; i < (parIndent * Settings.getTabSize()); i++) {
            indentBuilder.append(" ");
        }
        return indentBuilder.toString();
    }
}

Related Tutorials