ContainsAll

public static bool ContainsAll(this String str, params String[] values)
{
    if (!String.IsNullOrEmpty(str) || values.Length > 0)
    {
        foreach (String value in values)
        {
            if (!str.Contains(value))
            {
                return false;
            }
        }
    }

    return true;
}
Example:
String.ContainsAll(new String[] {"para1", "para2"});

Description

Check if the string contains all the elements in the array.

Details

  • Author: Jim
  • Submitted on: 8/29/2010 7:57:11 AM
  • Language: C#
  • Type: System.String
  • Views: 1531

Double click on the code to select all.

 

;