public static string GetWordFromPointer(TextPointer pointer, Logic.TextInLanguage textInLanguage) { string word; int firstIndex; int lastIndex; bool inWord = GetWordFromPointer(pointer, textInLanguage, out word, out firstIndex, out lastIndex); if (inWord) { return(word); } else { return(null); } }
public static bool GetWordFromPointer(TextPointer pointer, Logic.TextInLanguage textInLanguage, out string word, out int firstIndex, out int lastIndex) { Logic.TextInLanguage.SyntaxLayout.Word wordData; GetWordFromPointer(pointer, textInLanguage, out wordData); bool wordDataExists = wordData != null; if (wordDataExists) { word = wordData.ToString(); firstIndex = wordData.FirstIndex; lastIndex = wordData.LastIndex; } else { word = null; firstIndex = -1; lastIndex = -1; } return(wordDataExists); }
public static void GetWordFromPointer(TextPointer pointer, Logic.TextInLanguage textInLanguage, out Logic.TextInLanguage.SyntaxLayout.Word word) { if (pointer != null) { int letterIdx = GetTextIndexInParagraphFromPointer(pointer); Logic.TextInLanguage.SyntaxLayout.WordInSentenceIndex index; bool inWord = textInLanguage.Layout.GetWordInSentenceIndexByTextLetterIndex(letterIdx, out index); var wordData = textInLanguage.Layout.GetWordByIndex(index); if (inWord) { word = wordData; } else { word = null; } return; } word = null; }