例如:
and YY_ArriveTime>='2018-12-31 17:00:00' and YY_ArriveTime <= '2019-12-31 16:59:59'
我想截取第一个and 后面的都保留,
public static string CutStarStr(string s, string searchStr, string replaceStr)
{
var result = s;
try
{
if (string.IsNullOrEmpty(result))
{
return result;
}
if (s.Length < searchStr.Length)
{
return result;
}
if (s.IndexOf(searchStr, 0, searchStr.Length, StringComparison.Ordinal) > -1)
{
result = s.Substring(searchStr.Length);
}
return result;
}
catch (Exception e)
{
return result;
}
}