Contains Illegal Characters - CSharp System

CSharp examples for System:String Contain

Description

Contains Illegal Characters

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using System.Collections.Generic;
using System;//from w  ww  .j a  v a 2  s.  com

public class Main{
        public static bool ContainsIllegalCharacters(string searchText)
        {
            if (searchText.Contains("/") || searchText.Contains("\\") || searchText.Contains(":") || searchText.Contains("?") || searchText.Contains("\"") || searchText.Contains("<") || searchText.Contains(">") || searchText.Contains("|") || searchText.Contains("*"))
            {
                return true;
            }
            return false;
        }
}

Related Tutorials