• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to search for string in file

 
padma patil
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to java file system.
Can anybody tell me how I can search a file to find a perticular string in it.
Do I need to fetch each string/word and check for the matching string?
Please help me out
thanks
padmashree
 
Siva Prasad
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok here is the code I wrote for this.
this takes two arguments
1 - string to find
2 - filename


You can have a look at indexOf methods from String class.
HtH
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!