Browse Source

Refactor and add comment for clarity

pull/1119/head
Rafaat Mir 8 years ago
parent
commit
87c33cc345
  1. 13
      ILSpy/SearchStrategies.cs

13
ILSpy/SearchStrategies.cs

@ -129,21 +129,26 @@ namespace ICSharpCode.ILSpy @@ -129,21 +129,26 @@ namespace ICSharpCode.ILSpy
return true;
}
private bool IsNoncontiguousMatch(string text, string searchTerm)
bool IsNoncontiguousMatch(string text, string searchTerm)
{
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(searchTerm)) {
return false;
}
var textLength = text.Length;
if (searchTerm.Length > textLength) {
return false;
}
var index = 0;
foreach (char c in searchTerm) {
while (index != text.Length) {
while (index != textLength) {
if (text[index] == c) {
index++;
break;
}
index++;
}
if (index == text.Length)
}
// Check if we reached end of text without matching the full search string
if (index == textLength)
return false;
}
return true;

Loading…
Cancel
Save