String Starts With : String Search « Data Types « C# / C Sharp






String Starts With

   


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Utils
{
    public static bool StringStartsWith(string stringToSearch, string[] searchValues)
    {
        bool result = false;

        foreach (string value in searchValues)
        {
            result = result || stringToSearch.StartsWith(value);
            if (result) break;
        }

        return result;
    }
}

   
    
    
  








Related examples in the same category

1.Search stringsSearch strings
2.use the IndexOf() and LastIndexOf() methods to search for substrings and characters;
3.String search: last indexString search: last index
4.String search DemoString search Demo
5.String split and searchString split and search
6.Ensure End With SemiColon
7.Checks whether the string starts with a number or not
8.Checks whether the string starts with an alphabet or not
9.Finds a given string and enclosing it with tags provided.