Skip to content

Instantly share code, notes, and snippets.

@lebbe
Last active December 22, 2015 00:09
Show Gist options
  • Save lebbe/6387081 to your computer and use it in GitHub Desktop.
Save lebbe/6387081 to your computer and use it in GitHub Desktop.
Compute the class attribute for a html tag
class HTMLUtil {
// ... other code
public static String styleClass(String ... styleClasses) {
StringBuffer result = new StringBuffer();
result.append("class=\"");
for(String styleClass: styleClasses)
if(styleClass != null)
result.append(styleClass).append(" ");
result.append("\"");
return result.toString();
}
// ... other code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment