Android examples for java.lang:String HTML
Build start Tag With Attributes from Map<String,String>
//package com.java2s; import java.util.Map; import java.util.Map.Entry; public class Main { public static final String startTagWithAttributes(String tagName, Map<String, String> attributes) { return startTagWithAttributes(tagName, attributes, false); }//from w w w. j a va 2s .c o m public static final String startTagWithAttributes(String tagName, Map<String, String> attributes, boolean closed) { StringBuilder sb = new StringBuilder(); sb.append("<" + tagName + " "); for (Entry<String, String> entry : attributes.entrySet()) { sb.append(entry.getKey() + "=\"" + entry.getValue() + "\" "); } sb.append((closed ? "/" : "") + ">"); return sb.toString(); } }