title: Check file extension
body: <p>I am using the following PowerShell code and I need to check its extension in an if condition</p>
  
  <pre class="lang-powershell prettyprint-override"><code>foreach ($line in $lines) {
      $extn = $line.Split("{.}")[1]
      if ($extn -eq "xml" )
      {
      }
  }
  </code></pre>
  
  <p>Is there a straightforward way to check string extensions in PowerShell script in case of strings?</p>