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. General Programming
  3. Visual Basic
  4. Searching a particular text

Searching a particular text

Scheduled Pinned Locked Moved Visual Basic
algorithms
7 Posts 5 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
    Archana New to Dotnet
    wrote on last edited by
    #1

    can any tell me how simplest of way to find whether a string exists in a file. for eg.I have file tat ends with "}" I have to close the file ,if tat exists Thanks in advance

    D T T 3 Replies Last reply
    0
    • A Archana New to Dotnet

      can any tell me how simplest of way to find whether a string exists in a file. for eg.I have file tat ends with "}" I have to close the file ,if tat exists Thanks in advance

      D Offline
      D Offline
      DA_Loring
      wrote on last edited by
      #2

      If Instr(strYourString,strYourCharacter) > 0 Then End if

      David Loring !! Keep Music Live !!

      1 Reply Last reply
      0
      • A Archana New to Dotnet

        can any tell me how simplest of way to find whether a string exists in a file. for eg.I have file tat ends with "}" I have to close the file ,if tat exists Thanks in advance

        T Offline
        T Offline
        Tom Deketelaere
        wrote on last edited by
        #3

        if yourstring.contains("yourchar") then

        A 1 Reply Last reply
        0
        • T Tom Deketelaere

          if yourstring.contains("yourchar") then

          A Offline
          A Offline
          Archana New to Dotnet
          wrote on last edited by
          #4

          actually i want to open a file and search if "}" exists.

          T 1 Reply Last reply
          0
          • A Archana New to Dotnet

            actually i want to open a file and search if "}" exists.

            T Offline
            T Offline
            Tom Deketelaere
            wrote on last edited by
            #5

            dim textreader as textreader (or somthing like that ;P) do while not textreader.EOF dim s as string = textreader.readline if s.contains("}")then 'do somthing end if loop

            L 1 Reply Last reply
            0
            • T Tom Deketelaere

              dim textreader as textreader (or somthing like that ;P) do while not textreader.EOF dim s as string = textreader.readline if s.contains("}")then 'do somthing end if loop

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Unless your file turns out to be very big, you could simplify a lot and use File.ReadAllText method. :)

              Luc Pattyn


              try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


              1 Reply Last reply
              0
              • A Archana New to Dotnet

                can any tell me how simplest of way to find whether a string exists in a file. for eg.I have file tat ends with "}" I have to close the file ,if tat exists Thanks in advance

                T Offline
                T Offline
                The ANZAC
                wrote on last edited by
                #7

                dim s as string = system.io.file.readalltext("C:\Example") if s.contains("}") then 'do your actions end if

                Please check out my articles: The ANZAC's articles

                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