Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. Help: How to Search a text file for a string

Help: How to Search a text file for a string

Scheduled Pinned Locked Moved IT & Infrastructure
helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Adam Sooley
    wrote on last edited by
    #1

    I need some help on how to Search a text file for a string that is in a text file. This will be used in a Applet. Their will be a text box and when you enter a word ex("adam") and press search it will read the text file to see is adam is a valid entry. If it is a valid entry it will return true to a text area if not true it will return false to the text area. Any help would be great.

    S C 2 Replies Last reply
    0
    • A Adam Sooley

      I need some help on how to Search a text file for a string that is in a text file. This will be used in a Applet. Their will be a text box and when you enter a word ex("adam") and press search it will read the text file to see is adam is a valid entry. If it is a valid entry it will return true to a text area if not true it will return false to the text area. Any help would be great.

      S Offline
      S Offline
      Sameer Maggon
      wrote on last edited by
      #2

      Hi, There may be many methods to do that.. but i'll tell you a ral simple one.. Just open the text file you want to search in... and then traverse throughout the file and do a character by character comparison with the string Regards Sameer

      1 Reply Last reply
      0
      • A Adam Sooley

        I need some help on how to Search a text file for a string that is in a text file. This will be used in a Applet. Their will be a text box and when you enter a word ex("adam") and press search it will read the text file to see is adam is a valid entry. If it is a valid entry it will return true to a text area if not true it will return false to the text area. Any help would be great.

        C Offline
        C Offline
        Christopher Duncan
        wrote on last edited by
        #3

        If you're using it in an Applet, does that imply Java (forgive the ignorance of the question, I'm not a Java guy)? In any event, I'd explore the String classes that are available. They typically have fairly robust text searching / comparision features. No point reinventing the wheel... Chistopher Duncan Author - The Career Programmer: Guerilla Tactics for an Imperfect World (Apress)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups