0

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;
	  
}
}
}
2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by stultuske
0

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?

0

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

0

it should filter the data

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.