Beispiel #1
0
 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();
 }
Beispiel #2
0
  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();
  }