Answers for "search in string in c#"

C#
1

find-text-in-string-with-c-sharp

public static string getBetween(string strSource, string strStart, string strEnd)
{
    if (strSource.Contains(strStart) && strSource.Contains(strEnd))
    {
        int Start, End;
        Start = strSource.IndexOf(strStart, 0) + strStart.Length;
        End = strSource.IndexOf(strEnd, Start);
        return strSource.Substring(Start, End - Start);
    }

    return "";
}
Posted by: Guest on July-27-2021
-1

c# search string array

string [] arr = {"One","Two","Three"};
       var target = "One";
       var results = Array.FindAll(arr, s => s.Equals(target));
Posted by: Guest on August-07-2020

C# Answers by Framework

Browse Popular Code Answers by Language