1:   // TextUtility.cs
2:   // Copyright (C) 2001 Mike Krueger
3:   //
4:   // This program is free software; you can redistribute it and/or modify
5:   // it under the terms of the GNU General Public License as published by
6:   // the Free Software Foundation; either version 2 of the License, or
7:   // (at your option) any later version.
8:   //
9:   // This program is distributed in the hope that it will be useful,
10:   // but WITHOUT ANY WARRANTY; without even the implied warranty of
11:   // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12:   // GNU General Public License for more details.
13:   //
14:   // You should have received a copy of the GNU General Public License
15:   // along with this program; if not, write to the Free Software
16:   // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17:  
18:   using System;
19:  
20:   using SharpDevelop.DefaultEditor.Text;
21:  
22:   namespace SharpDevelop.DefaultEditor.Util {
23:       
24:       public class TextUtility
25:       {
26:           
27:           public static bool RegionMatches(IDocument documentint offsetint lengthstring word)
28:           {
29:               if (length != word.Length || document.TextLength offset length) {
30:                   return false;
31:               }
32:               
33:               for (int 0length; ++i) {
34:                   if (document.GetCharAt(offset i) != word[i]) {
35:                       return false;
36:                   }
37:               }
38:               return true;
39:           }
40:           
41:           public static bool RegionMatches(IDocument documentbool casesensitiveint offsetint lengthstring word)
42:           {
43:               if (casesensitive) {
44:                   return RegionMatches(documentoffsetlengthword);
45:               }
46:               
47:               if (length != word.Length || document.TextLength offset length) {
48:                   return false;
49:               }
50:               
51:               for (int 0length; ++i) {
52:                   if (Char.ToUpper(document.GetCharAt(offset i)) != Char.ToUpper(word[i])) {
53:                       return false;
54:                   }
55:               }
56:               return true;
57:           }
58:           
59:           public static bool RegionMatches(IDocument documentint offsetint lengthchar[] word)
60:           {
61:               if (length != word.Length || document.TextLength offset length) {
62:                   return false;
63:               }
64:               
65:               for (int 0length; ++i) {
66:                   if (document.GetCharAt(offset i) != word[i]) {
67:                       return false;
68:                   }
69:               }
70:               return true;
71:           }
72:           
73:           public static bool RegionMatches(IDocument documentbool casesensitiveint offsetint lengthchar[] word)
74:           {
75:               if (casesensitive) {
76:                   return RegionMatches(documentoffsetlengthword);
77:               }
78:               
79:               if (length != word.Length || document.TextLength offset length) {
80:                   return false;
81:               }
82:               
83:               for (int 0length; ++i) {
84:                   if (Char.ToUpper(document.GetCharAt(offset i)) != Char.ToUpper(word[i])) {
85:                       return false;
86:                   }
87:               }
88:               return true;
89:           }
90:       }
91:   }

This page was automatically generated by SharpDevelop.