how to make backword search in text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmed222too
    New Member
    • Sep 2007
    • 47

    how to make backword search in text

    this command makes forword search in text:

    instr(begining of search in integer,the text, the word you want search for)

    my question is how to make backword search when the compiler in a certain place

    thank you
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    What version of VB are you using?

    And can you please explain in more detail what you mean by a "backward search"? Do you want it to look for the word appearing in reverse sequence (such as typing "hello" and searching for "olleh")? Or do you want it to start at the end of the string and find the last occurence instead of the first, or what?

    Comment

    • ahmed222too
      New Member
      • Sep 2007
      • 47

      #3
      Originally posted by Killer42
      What version of VB are you using?

      And can you please explain in more detail what you mean by a "backward search"? Do you want it to look for the word appearing in reverse sequence (such as typing "hello" and searching for "olleh")? Or do you want it to start at the end of the string and find the last occurence instead of the first, or what?
      i use vb6

      i mean (by backword search) to begin the search from the last for example (i will go to school to learn more....) i want to find the last time the word (to) happened then the next backwordly

      Comment

      • ahmed222too
        New Member
        • Sep 2007
        • 47

        #4
        i use vb6

        i mean (by backword search) to begin the search from the last for example (i will go to school to learn more....) i want to find the last time the word (to) happened then the next backwordly

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          I believe that the InstrRev() function will be useful here. I haven't used it before, but I just tried these two examples in the immediate window and got the responses shown...
          Code:
          ? instrrev("This is a test and a test","test")
          [B]22[/B]
          
          ? instrrev("This is a test and a test","test"[B],22[/B])
          [B]11[/B]

          Comment

          • ahmed222too
            New Member
            • Sep 2007
            • 47

            #6
            Originally posted by Killer42
            I believe that the InstrRev() function will be useful here. I haven't used it before, but I just tried these two examples in the immediate window and got the responses shown...
            Code:
            ? instrrev("This is a test and a test","test")
            [B]22[/B]
            
            ? instrrev("This is a test and a test","test"[B],22[/B])
            [B]11[/B]
            iam sorry for opening new thread and for spelling mistakes (iam from egypt and my mother tongue is arabic)
            and thank you for your useful reply
            thank u

            Comment

            Working...