當前位置: 首頁>>代碼示例>>C#>>正文


C# TextEditor.GetCharAt方法代碼示例

本文整理匯總了C#中MonoDevelop.Ide.Gui.TextEditor.GetCharAt方法的典型用法代碼示例。如果您正苦於以下問題:C# TextEditor.GetCharAt方法的具體用法?C# TextEditor.GetCharAt怎麽用?C# TextEditor.GetCharAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MonoDevelop.Ide.Gui.TextEditor的用法示例。


在下文中一共展示了TextEditor.GetCharAt方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetWhitespaces

		public static string GetWhitespaces (TextEditor editor, int insertionOffset)
		{
			StringBuilder result = new StringBuilder ();
			for (int i = insertionOffset; i < editor.Length; i++) {
				char ch = editor.GetCharAt (i);
				if (ch == ' ' || ch == '\t') {
					result.Append (ch);
				} else {
					break;
				}
			}
			return result.ToString ();
		}
開發者ID:sushihangover,項目名稱:monodevelop,代碼行數:13,代碼來源:RefactoringOptions.cs

示例2: FindPrevWordStart

		static int FindPrevWordStart (TextEditor editor, int offset)
		{
			while (--offset >= 0) {
				var c = editor.GetCharAt (offset);
				//Only legal characters in template Shortcut
				//LetterOrDigit make sense
				//_ to allow underscore naming convention
				//# is because there are #if templates
				//~ because disctructor template
				//@ some Razor templates start with @
				//in theory we should probably just support LetterOrDigit and _
				if (!char.IsLetterOrDigit (c) && c != '_' && c != '#' && c != '~' && c != '@') {
					break;
				}
			}
			return ++offset;
		}
開發者ID:ZZHGit,項目名稱:monodevelop,代碼行數:17,代碼來源:CodeTemplate.cs

示例3: IsMatchAt

		static bool IsMatchAt (TextEditor editor, int offset, string abbrevWord)
		{
			if (offset + abbrevWord.Length >= editor.Length)
				return false;
			if (offset > 0 && IsIdentifierPart (editor.GetCharAt (offset - 1)))
				return false;
			if (offset + abbrevWord.Length < editor.Length && !IsIdentifierPart (editor.GetCharAt (offset + abbrevWord.Length)))
				return false;
			return editor.GetTextAt (offset, abbrevWord.Length) == abbrevWord;
		}
開發者ID:pabloescribanoloza,項目名稱:monodevelop,代碼行數:10,代碼來源:DynamicAbbrevHandler.cs

示例4: SearchEndPos

		static int SearchEndPos (int offset, TextEditor editor)
		{
			while (offset < editor.Length && IsIdentifierPart (editor.GetCharAt (offset))) {
				offset++;
			}
			return offset;
		}
開發者ID:pabloescribanoloza,項目名稱:monodevelop,代碼行數:7,代碼來源:DynamicAbbrevHandler.cs

示例5: GetWordBeforeCaret

		static string GetWordBeforeCaret (TextEditor editor)
		{
			int startOffset = editor.CaretOffset;
			int offset = startOffset - 1;
			while (offset > 0) {
				char ch = editor.GetCharAt (offset);
				if (!IsIdentifierPart (ch)) {
					offset++;
					break;
				}
				offset--;
			}
			if (offset >= startOffset)
				return "";
			return editor.GetTextBetween (offset, startOffset);
		}
開發者ID:pabloescribanoloza,項目名稱:monodevelop,代碼行數:16,代碼來源:DynamicAbbrevHandler.cs

示例6: SearchMatchingBracket

		static int SearchMatchingBracket (TextEditor editor, int offset, char openBracket, char closingBracket, int direction)
		{
			bool isInString       = false;
			bool isInChar         = false;	
			bool isInBlockComment = false;
			int depth = -1;
			while (offset >= 0 && offset < editor.TextLength) {
				char ch = editor.GetCharAt (offset);
				switch (ch) {
					case '/':
						if (isInBlockComment) 
							isInBlockComment = editor.GetCharAt (offset + direction) != '*';
						if (!isInString && !isInChar && offset - direction < editor.TextLength) 
							isInBlockComment = offset > 0 && editor.GetCharAt (offset - direction) == '*';
						break;
					case '"':
						if (!isInChar && !isInBlockComment) 
							isInString = !isInString;
						break;
					case '\'':
						if (!isInString && !isInBlockComment) 
							isInChar = !isInChar;
						break;
					default :
						if (ch == closingBracket) {
							if (!(isInString || isInChar || isInBlockComment)) 
								--depth;
						} else if (ch == openBracket) {
							if (!(isInString || isInChar || isInBlockComment)) {
								++depth;
								if (depth == 0) 
									return offset;
							}
						}
						break;
				}
				offset += direction;
			}
			return -1;
		}
開發者ID:transformersprimeabcxyz,項目名稱:monodevelop-1,代碼行數:40,代碼來源:CTextEditorExtension.cs


注:本文中的MonoDevelop.Ide.Gui.TextEditor.GetCharAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。