'Find closest word that starts with hashtag to the left of the cursor location in uitextview
I have this text in my UITextView.
"hello everyone these are #tag0 #tag1 #tag1 #tag2 #tagagain that is all"
If the user puts the cursor to the right of #tagagain tag then we should have something like this on UITextView "hello everyone these are #tag0 #tag1 #tag1 #tag2 #tapagain(cursor blinking) that is all". If the user then decides to move the cursor to the right of #tag1(cursor blinking) which is in italic then i need to find the closest word that starts with # which is #tag1 in italic actually. Same scenario should happen if the user moves the cursor to #tag1 but not to the right of #tag1 but instead after the first character #t(cursor blinking)ag1. In this scenario the text #t should return as the latest word. This should happen when the user moves the cursor and taps a character.
How can i get the latest word to the left side of the cursor? Any help appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
