02 | import java.util.StringTokenizer; |
04 | public class SearchString { |
07 | public static void main( String args[ ] ) { |
10 | SearchString searchString = new SearchString( args[ 0 ], args[ 1 ] ); |
11 | System.out.println( "The string: " + args[ 0 ] ); |
12 | System.out.println( "The query: " + args[ 1 ] ); |
14 | StringTokenizer keyword = new StringTokenizer( args[ 1 ], " " ); |
16 | while ( keyword.hasMoreTokens( ) ) |
18 | count += searchString.keywordSearch( keyword.nextToken( ) ); |
19 | System.out.println( "Number of keywords found: " + count ); |
27 | public SearchString( String s, String q ) { |
33 | public int keywordSearch( String keyword ) { |
36 | if ( str.toUpperCase( ).indexOf( keyword.toUpperCase( ) ) != - 1 ) |
|