-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHelper.cs
More file actions
25 lines (20 loc) · 786 Bytes
/
Copy pathHelper.cs
File metadata and controls
25 lines (20 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyNotepad {
public static class Helper {
public static List<int> GetIndexes(string pText, string pSearchText, bool pCaseSensitive) {
var Indexes = new List<int>();
var eStringComparison = pCaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
var StartIndex = 0;
while (true) {
var Index = pText.IndexOf(pSearchText, StartIndex, eStringComparison);
if (Index == -1) break;
Indexes.Add(Index);
StartIndex = Index + pSearchText.Length;
}
return Indexes;
}
}
}