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.
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.