public String asString(boolean lead, char sep) { StringBuffer result = new StringBuffer(); String seps = (lead ? " " : "") + sep + " "; String[] myTags = asArray(); for (int i = 0; i < myTags.length; i++) { if (i != 0) result.append(seps); result.append(myTags[i]); } return result.toString(); }
public static String asTag(String n) { StringBuffer result = new StringBuffer(n.length()); for (int i = 0; i < n.length(); i++) { char c = n.charAt(i); if (Character.isLetter(c)) { result.append(Character.toLowerCase(c)); } else if (Character.isDigit(c)) { result.append(c); } } return result.toString(); }