title: Using "starts with" in powershell script instead of contains?
body: <p>In my current powershell script I have hash table with values. Am using 
  this syntax </p>
  
  <pre><code>$x = $f.contains("$k")
  </code></pre>
  
  <p>but I figured recently that am having problems with this approach I was wondering if powershell has something that says "starts with," or related, that would search thru the hash table with "starts with" instead of <code>contains</code> </p>
  
  <p>Example of the hash table:</p>
  
  <pre><code>"bio.txt" = "server1\datafiles\bio";
  etc.......
  </code></pre>
  
  <p><strong>EDIT</strong> Sample from comments</p>
  
  <pre><code>foreach ($key in $filehash.keys) { 
      $path = $filehash.get_Item($key)
      $filecount = 0
      foreach ($file in $FileArray) { 
          if ($file.LastWriteTime -lt($(GetDate).adddays(-1))) { 
              [string] $k = $key.ToLower()
              [string] $f = $file.name.ToLower() 
              if ($x = $f.contains("$k")) { } 
          }
      }
  }
  </code></pre>