string contains in Jquery

Like this:

if (str.indexOf("Yes") >= 0)
if (str.indexOf("Yes") >= 0)
  1. <code>
  2. if (str.indexOf("Yes") >= 0)
  3. </code>
<code>
if (str.indexOf("Yes") >= 0)
</code>
Note that this is case-sensitive. If you want a case-insensitive search, you can write

if (str.toLowerCase().indexOf("yes") >= 0)
Or,
if (/yes/i.test(str))
if (str.toLowerCase().indexOf("yes") >= 0)
Or,
if (/yes/i.test(str))
  1. <code>
  2. if (str.toLowerCase().indexOf("yes") >= 0)
  3. Or,
  4. if (/yes/i.test(str))
  5. </code>
<code>
if (str.toLowerCase().indexOf("yes") >= 0)
Or,
if (/yes/i.test(str))
</code>

Popular posts from this blog

Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=xx.0.0.0, Culture=neutral, PublicKeyToken='xxx' or one of its dependencies.

C# Crop white space from around the image

The specified version string contains wildcards, which are not compatible with determinism.