Im looking for a function that will enable me to find a certain string in a textRange and gives me back its textPointers(beginning and end) whats the best approach or is there any textRange method that can help me ? Thanks.
I have a problem in my approach which happens when i have same words in my textRange and im trying to get the Textpointer for each word in the textRange.
For example my text in the textRange is "hello hello hello" and i want to get the text pointer for each word in the textRange, it will mix the second开发者_如何学Python and last word and give me (the first indexOf the word) or last depends on which method i use.
Something like this
string txt = tr.Text; //tr is your TextRange
string find = "a str";
int beginPtr = txt.IndexOf(find);
int endPrt = beginPtr + find.Length;
精彩评论