开发者

TextRange Find string c#

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜