T
thomasjbs
I can't figure this out - new to java, but code appears to be ok.
I'm looking for a string within lines of text returned from a system
command. I get all the output back - no problem. But when I try to
do something based on indexOf, it always returns true:
Here is output from System.out.println statements showing the text
does *not* exist in the output (and another example showing it does)
Here is the code to search for it. On
int tf = 0;
boolean textfound = false;
// Loop through lines of text with Try and readLine...
{
tf = inputLine.indexOf("FINDTHISSTRING");
System.out.println(tf);
if ( tf > -1 );
{
textfound = true;
}
}
I also tried " tf == 0 ".
Example of Failure to find Text
======================
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
Example of case where FIND text Exists:
==============================
-1
-1
-1
-1
-1
-1
0 Found it here
-1
0 and Here
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
I'm looking for a string within lines of text returned from a system
command. I get all the output back - no problem. But when I try to
do something based on indexOf, it always returns true:
Here is output from System.out.println statements showing the text
does *not* exist in the output (and another example showing it does)
Here is the code to search for it. On
int tf = 0;
boolean textfound = false;
// Loop through lines of text with Try and readLine...
{
tf = inputLine.indexOf("FINDTHISSTRING");
System.out.println(tf);
if ( tf > -1 );
{
textfound = true;
}
}
I also tried " tf == 0 ".
Example of Failure to find Text
======================
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
Example of case where FIND text Exists:
==============================
-1
-1
-1
-1
-1
-1
0 Found it here
-1
0 and Here
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1