Results 1 to 2 of 2
Thread: Printing selected output only
- 11-28-2012, 02:12 PM #1Member
- Join Date
- Nov 2012
- Rep Power
Printing selected output only
If I have an output in my console, such as:
Apples are good
Bananas are amazing
Pears are cool
Fruits are awesome
How would I go about reading in these output lines and then saying, if the line starts with "Apples" print "good". But reading it all from the line and not hard-coding the "good"?
So, it wouldn't print every line just "good" because that is the only line that starts with "Apples"? I know there is a startsWith() function, but not sure how to use it when reading in lines.
- 11-28-2012, 04:33 PM #2
Re: Printing selected output only
How are you outputting the lines? They must be Strings, so you can use any String method on them.
I'd recommend posting an SSCCE that demonstrates exactly what you're talking about.
- By gabrielpr12 in forum New To JavaReplies: 4Last Post: 01-13-2012, 10:47 PM
- By KonchShell in forum New To JavaReplies: 9Last Post: 03-16-2011, 12:50 PM
- By ShinTec in forum AWT / SwingReplies: 4Last Post: 06-04-2010, 11:10 AM
- By carrotcake in forum New To JavaReplies: 1Last Post: 04-04-2010, 06:37 AM
- By bigj in forum New To JavaReplies: 6Last Post: 01-30-2010, 03:55 PM