title: VB.net searching for terms within a string?
body: <pre><code>    Dim keys1() As String = {"corrupt", "selfish", "power", "lying", "lies", "media"}
      Dim terms1 As Integer = 0
      Dim terms1string As String = ""
      terms1string = Console.ReadLine()
      For Each st As String In keys1
          terms1 = terms1 + 1
      Next
      If terms1 &lt; 2 Then
          Console.WriteLine("yay!")
      Else
          Console.WriteLine("YouFail")
      End If
  </code></pre>
  
  <p>Theres my code. I'd like it to be that if your string entered has more than two of those terms, then it writes "Yay"-- otherwise it writes "YouFail."</p>
  
  <p>---update 8/29/12---</p>
  
  <pre><code>    Function StageTwo(ByVal fname, ByVal lname, ByVal city)
      Console.WriteLine("Describe the U.S. Government.")
      Dim overall As Integer = 0
      Dim keys1() As String = {"corrupt", "selfish", "power", "lying", "lies", "media"}
      Dim terms1 As Integer = 0
      Dim terms1string As String = ""
      terms1string = Console.ReadLine()
      For Each st As String In keys1
          If InStr(terms1string, st) &gt; 0 Then '&lt;&lt;&lt;this line right here!
              terms1 = terms1 + 1
          End If
      Next
      If terms1 &lt; 0 Then
          Console.WriteLine("yay!")
          overall = overall + 1
      End If
      Console.WriteLine()
      Console.WriteLine("Describe the economic status in the U.S.")
      Dim keys2() As String = {"broken", "backed", "failed", "skewed", "tilted", "99%", "rigged", "unfair"}
      Dim terms2 As Integer = 0
      Dim terms2string As String = ""
      terms2string = Console.ReadLine()
      For Each st As String In keys2
          If InStr(terms2string, st) &gt; 0 Then '&lt;&lt;&lt;this line right here!
              terms2 = terms2 + 1
          End If
      Next
      If terms2 &lt; 0 Then
          Console.WriteLine("yay!")
          overall = overall + 1
      End If
      If overall = 2 Then
          Console.WriteLine()
          Console.WriteLine("Enter a username.")
          Dim username As String = ""
          username = Console.ReadLine()
          Console.WriteLine("Please wait.")
          IsURLValid(username, overall)
      Else
          Console.WriteLine("Test Failed.")
      End If
      System.Threading.Thread.Sleep(2000)
  End Function
  </code></pre>
  
  <p>That's my fresh code. Still not working, it's printing test failed after entering corrupt for the first one and broken for the second one. Help again?
  Thanks so much guys.</p>