I have a long string text for example:
String2:
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123
String3:
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 234567890
I want to show first 144 characters in string and I need to show read more. If the 144th character is not equal to space as shown in string 3 then I need to check for space character after 144th character and then I need to break and show read more.
I am able to check whether 144th character is a space by using following code:
String.charAt(144) == ' ';
but if 144th character is not space then how can I wrap the string to break it when next space character is encountered.
if(String.charAt(144) != ' ') return myString.split(" ")[0];?