current.Data = value;
numbers[i] % 2
заменить на i % 2
public static bool CheckWords(string text)
{
List<string[]> lines = new List<string[]>();
string[] arr_lines = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries );
foreach (string line in arr_lines)
{
string[] arr_words = line.Split(' ');
lines.Add(arr_words);
}
for (int current_line_num = 0; current_line_num < lines.Count - 1; current_line_num++)
{
for (int current_word_num = 0; current_word_num < lines[current_line_num].Length; current_word_num++)
{
if (current_word_num < lines[current_line_num + 1].Length
&& lines[current_line_num][current_word_num] == lines[current_line_num + 1][current_word_num])
{
return true; // совпадение!
}
}
}
return false;
}
public static void TestTexts()
{
string text =
@"This sentence is pretty long and
this sentence is also a test";
bool res = CheckWords(text);
string text2 =
@"This sentence also shouldn't
match as this has no words
below";
bool res2 = CheckWords(text2);
}
public static IOrderedEnumerable<T> OrderByAlphaNumeric<T>(this IEnumerable<T> source, Func<T, string> selector)
{
int max = source
.SelectMany(i => Regex.Matches(selector(i), @"\d+").Cast<Match>().Select(m => (int?)m.Value.Length))
.Max() ?? 0;
return source.OrderBy(i => Regex.Replace(selector(i), @"\d+", m => m.Value.PadLeft(max, '0')));
}
var xhr = new XMLHttpRequest();
xhr.open('GET', 'Get133Report.aspx?date=' + date, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function (e) {
var blob = new Blob([this.response], { type: 'application/vnd.ms-excel' });
var downloadUrl = URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = downloadUrl;
a.download = "Отчет_133_" + date + ".xls";
document.body.appendChild(a);
a.click();
HideProgress();
};
ShowProgress();
xhr.send();