Sunday 18 August 2013

start index of word in RichTextBox using C# [on hold]

start index of word in RichTextBox using C# [on hold]

I have a RichTextBox in a Winform application. I need to get the start
index of the last entered word in the RTB. Say the sentence user types is
' quick brown fox,. now it's easy to get the start index of the word 'fox'
using the following code
int startindex = rtb.Text.TrimEnd().LastIndexOf(' ');
But now if the user types 'brown' in the middle (say after 'quick') the
how do we get the start index of the word 'brown' ?

No comments:

Post a Comment