Это может быть очень просто, но хотелось бы знать, есть ли альтернатива, чтобы найти строку между исходной строкой, которая путем передачи ее начальной и конечной строки
с помощью этого кода можно достичь следующего, ноэтот код лучше, чем этот, так как я думаю, что это замедлит работу системы, если ее использовать во многих условиях.
string strSource = "The LoadUserProfile call failed with the following error: ";
string strResult = string.Empty;
string strStart = "loaduserProfile";
string strEnd = "error";
int startindex = strSource.IndexOf(strStart, StringComparison.OrdinalIgnoreCase);
int endindex = strSource.LastIndexOf(strEnd, StringComparison.OrdinalIgnoreCase);
startindex = startindex + strStart.Length;
int endindex = endindex - startindex;
strResult = strSource.Substring(startindex, endindex);
Спасибо D.Mahesh