I have a text area where a user can enter free flow text. I want to separate out lines/occurrences in my Java class based on the below conditions:
When the user does not press the enter key, I want to get substrings (texts) of 10 characters each. When the user does press enter, I want to separate that part out and start again counting till 15 to get a new substring till I reach the end of the free flow text/string.
Eg, If user enters:
Hello I want enter key to be caught.
I want this text to be separated into the below substrings:
- Hello I want (assuming the user pressed enter key at this point)
- enter key to be (as the limit is 15)
- caught