hi,
I want to read the string as many time and filter that string, store in hashtable. I don't know any filter command is present in java.here I am sending the code.

import java.util.StringTokenizer;
 import java.util.Hashtable;
import java.util.Enumeration;
 
public class test123 {
	public static void main(String[] args) {
		String line = "be$whatever$you$can$be";
	    String key;
Hashtable hash=new Hashtable();
	StringTokenizer parser = new StringTokenizer(line,"$");
	    while (parser.hasMoreTokens()) {
       
 key = parser.nextToken();
	System.out.print(key + " ");

System.out.println(hash.put(key,1)); 
  }
System.out.println("Retriving all keys from the Hashtable");

Enumeration e = hash.keys();

while( e. hasMoreElements() ){

System.out.println( e.nextElement() );
	        
	//        break;
	  
}
}
}

you might want to make a bit more clear what you mean by: "filter that String"

would you like to get the same String without spaces, without vowels, would you like to split it into seperate String Objects?

if the data is entered multiple times by the client..
it should filter the data and store it in the hashtable...

it should filter the data

how should it be filtered... no double inputs, no inputs containing certain words, ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.