Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Enumeration; import java.util.Hashtable; public class Main { /** * Returns string keys in a hashtable as delimited string * * @param ht * , Hashtable * @param delimiter * , String * @param exclude * , exclude channel if present as substring * @return , string array with hash keys string */ public static synchronized String hashTableKeysToDelimitedString(Hashtable ht, String delimiter, String exclude) { StringBuffer sb = new StringBuffer(); boolean first = true; Enumeration e = ht.keys(); while (e.hasMoreElements()) { String s = (String) e.nextElement(); if (exclude != null) { if (s.indexOf(exclude) != -1) { continue; } } if (first) { sb.append(s); first = false; } else { sb.append(delimiter).append(s); } } return sb.toString(); } /** * Returns string keys in a hashtable as delimited string * * @param ht * , Hashtable * @param delimiter * , String * @return , string array with hash keys string */ public static String hashTableKeysToDelimitedString(Hashtable ht, String delimiter) { return hashTableKeysToDelimitedString(ht, delimiter, null); } }