Code Coverage Statistics for Source File
c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Util\TextUtility.cs
|
Sequence Point Coverage
N/A
0 of 0
|
Branch Coverage
N/A
0 of 0
|
Lines
81
|
Highlight:
Uncovered Code
Covered Code
| L | V | Source |
|---|---|---|
1 |
// <file> |
|
2 |
// <copyright see="prj:///doc/copyright.txt"/> |
|
3 |
// <license see="prj:///doc/license.txt"/> |
|
4 |
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/> |
|
5 |
// <version>$Revision: 915 $</version> |
|
6 |
// </file> |
|
7 |
||
8 |
using System; |
|
9 |
||
10 |
using ICSharpCode.TextEditor.Document; |
|
11 |
||
12 |
namespace ICSharpCode.TextEditor.Util |
|
13 |
{ |
|
14 |
public class TextUtility |
|
15 |
{ |
|
16 |
||
17 |
public static bool RegionMatches(IDocument document, int offset, int length, string word) |
|
18 |
{ |
|
19 |
if (length != word.Length || document.TextLength < offset + length) { |
|
20 |
return false; |
|
21 |
} |
|
22 |
||
23 |
for (int i = 0; i < length; ++i) { |
|
24 |
if (document.GetCharAt(offset + i) != word[i]) { |
|
25 |
return false; |
|
26 |
} |
|
27 |
} |
|
28 |
return true; |
|
29 |
} |
|
30 |
||
31 |
public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, string word) |
|
32 |
{ |
|
33 |
if (casesensitive) { |
|
34 |
return RegionMatches(document, offset, length, word); |
|
35 |
} |
|
36 |
||
37 |
if (length != word.Length || document.TextLength < offset + length) { |
|
38 |
return false; |
|
39 |
} |
|
40 |
||
41 |
for (int i = 0; i < length; ++i) { |
|
42 |
if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) { |
|
43 |
return false; |
|
44 |
} |
|
45 |
} |
|
46 |
return true; |
|
47 |
} |
|
48 |
||
49 |
public static bool RegionMatches(IDocument document, int offset, int length, char[] word) |
|
50 |
{ |
|
51 |
if (length != word.Length || document.TextLength < offset + length) { |
|
52 |
return false; |
|
53 |
} |
|
54 |
||
55 |
for (int i = 0; i < length; ++i) { |
|
56 |
if (document.GetCharAt(offset + i) != word[i]) { |
|
57 |
return false; |
|
58 |
} |
|
59 |
} |
|
60 |
return true; |
|
61 |
} |
|
62 |
||
63 |
public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, char[] word) |
|
64 |
{ |
|
65 |
if (casesensitive) { |
|
66 |
return RegionMatches(document, offset, length, word); |
|
67 |
} |
|
68 |
||
69 |
if (length != word.Length || document.TextLength < offset + length) { |
|
70 |
return false; |
|
71 |
} |
|
72 |
||
73 |
for (int i = 0; i < length; ++i) { |
|
74 |
if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) { |
|
75 |
return false; |
|
76 |
} |
|
77 |
} |
|
78 |
return true; |
|
79 |
} |
|
80 |
} |
|
81 |
} |