Hello,

Here I have a problem, I want to print the word after the Delimiters in a simple text file, but i cant able to do it also cant able to find a good example for that in a web.
So please if anyone help for this.

Recommended Answers

All 11 Replies

What did you try?

thank you,

actually i tried this code

public class word 
{
 	
	public static void main(String[] args)
	{
		String line=" ";
		int lineNo;
		
		try
		{
			FileReader fr= new FileReader("f:/parse1.txt");
			BufferedReader br=new BufferedReader(fr);
			for(lineNo = 1; lineNo <=4; lineNo++)
			{
				if(lineNo == 2 )
				{
				line = br.readLine();
				
				StringTokenizer st=new StringTokenizer(line,"-->");
				
				while(st.hasMoreTokens())
				{
					String s=st.nextToken();
					System.out.println(s);
				}
				
				}else
				{
					br.readLine();
				}
				
				
			}
			
		}catch(Exception e)
		{
			System.out.println(e);
		}
	}

}

My content in the text file is:

(FusionResultProcessor.java:145) - -------------------> Feed id: 0001 processing

SUCCEEDED. ProcessingTimeTook: 5 milliseconds.

got the output as,

(FusionResultProcessor.java:145)

Feed id: 0001 processing


I want to print only the feed id: xxx and i dont want to print the (fusion...). that is I want to print the data after the delimiter.

What happens? Do you get errors? If so please copy and paste the full text here.
Otherwise show the programs output and explain what is wrong with it.

hello,
I have already mentioned that what kind of output I am getting.

My question is how to print the data(for eg. Feed id:0001..) after the delimiter(">") and I dont want to print the text before the delimiter (">");

thank you,

What happens? Do you get errors? If so please copy and paste the full text here.
Otherwise show the programs output and explain what is wrong with it.

Hello NormR1,

No I didnt get any errors, but I out put is

just like this


"(FusionResultProcessor.java:145)

Feed id: 0001 processing"

Can you make a test program with a String containing the delimiters and data that you want to print instead of requiring a separate test file. I assume that you do not need more than one line to show the problem.

Then we can all look at exactly the same code and data and see what the problem is.
For example:
line = "The String > to test < right here";

Where in your code do you determine whether the token you are getting is before or after the delimiter? I only see a println() to show all the tokens.

out put is
just like this

What is wrong with that output? You need to explain what the output should look like.

What is wrong with that output? You need to explain what the output should look like.

hello,

I want to display only Feed id:0001 processing in my output window.

If you want help, look at my suggestion about writing a test program that I described in an earlier post. Put everything in ONE file and post it.
Execute the program, show what it outputs and say what is wrong with the output.

@dheaven:

Having looked at your previous posts, I'm assuming that you are either affiliated with the blog in consideration or own it. Posting self links is not recommended here and is seen as promotion. If you want to redirect users to your blog/help them, link your blog in the signature and refer them to it rather than having links as the post content.

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.