Original Post
I have the code:
public void searchString( String str )
{
String text = new String( textArea.getText() );
for( int a = 0; a < text.length() - str.length(); a++ )
{
for( int b = 0; b < str.length(); b++ )
{
if( text[a+b] != str[ b ] )
{
break;
}
if( b == str.length() - 1 )
{
System.out.println( "Found a match!!!" );
}
}
}
}
And I get the error: "Array required, but java.io.String found
if( text[a+b] != str[ b ] )"
I can't index a string? That seems strange if you ask me. Why can't I and how do I?
[edited by - Mulligan on October 10, 2002 10:41:58 PM]