wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes Parsing of StringBuffer(URGENT) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Parsing of StringBuffer(URGENT)" Watch "Parsing of StringBuffer(URGENT)" New topic
Author

Parsing of StringBuffer(URGENT)

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
Hi,
I have defined String Buffer of 2K capacity. Server is send me data withing that capacity of string Buffer. After StringBuffer recieves data from the server on client side, I want to parse it. I have delimeter ":" to parse the stringBuffer?
I tried to use StringTokenizer, Substring. But I can't get it.
Here is my example:
import java.applet.Applet;
import java.util.*;
public class sbDemo extends Applet{
StringBuffer sb;
StringTokenizer st;
public void init(){
sb.append("Anuja:shah:Konica:Business:Technology");
st = new StringTokenizer(sb,":");
while(st.hasMoreTokens()){
System.out.println("The String is --->" + st.nextToken());
}
}
}
Thanks,
Angela
Michael Dean
Greenhorn

Joined: Jul 31, 2000
Posts: 9
Angela: modify your code as follows:
st = new StringTokenizer(sb.toString(),":");
StringTokenizer takes arguments of type String, not StringBuffer...
HTH,
Michael

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parsing of StringBuffer(URGENT)
 
Similar Threads
String conversion
StringIndexOut OfBoundsException
StringBuffer Very Urgent please
how to print in capital of each frist word
need to transfer productID from url to action class in struts 2