/
n-dimens
/
pascalabcnet
Обзор
Документация
Войти
/
n-dimens
/
pascalabcnet
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ICSharpCode.TextEditor/Src/Util/TextUtility.cs
81 строка
2 KB
Бондарев Иван
initial commit
14 май 2015, 22:35
14 май 2015, 22:35
e6e67c1
Код
Авторство
О чём код?
// <file> // <copyright see="prj:///doc/copyright.txt"/> // <license see="prj:///doc/license.txt"/> // <owner name="Mike Krüger" email="mike@icsharpcode.net"/> // <version>$Revision: 915 $</version> // </file> using System; using ICSharpCode.TextEditor.Document; namespace ICSharpCode.TextEditor.Util { public class TextUtility { public static bool RegionMatches(IDocument document, int offset, int length, string word) { if (length != word.Length || document.TextLength < offset + length) { return false; } for (int i = 0; i < length; ++i) { if (document.GetCharAt(offset + i) != word[i]) { return false; } } return true; } public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, string word) { if (casesensitive) { return RegionMatches(document, offset, length, word); } if (length != word.Length || document.TextLength < offset + length) { return false; } for (int i = 0; i < length; ++i) { if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) { return false; } } return true; } public static bool RegionMatches(IDocument document, int offset, int length, char[] word) { if (length != word.Length || document.TextLength < offset + length) { return false; } for (int i = 0; i < length; ++i) { if (document.GetCharAt(offset + i) != word[i]) { return false; } } return true; } public static bool RegionMatches(IDocument document, bool casesensitive, int offset, int length, char[] word) { if (casesensitive) { return RegionMatches(document, offset, length, word); } if (length != word.Length || document.TextLength < offset + length) { return false; } for (int i = 0; i < length; ++i) { if (Char.ToUpper(document.GetCharAt(offset + i)) != Char.ToUpper(word[i])) { return false; } } return true; } } }