📜  find-text-in-string-with-c-sharp - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:23.905000             🧑  作者: Mango

代码示例1
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 "";
}