In my app I have a plist of many quotes. These quotes are loaded into a UILabel, and has the option to share with Twitter. Some quotes are quite long, and I know I could easily cut all characters past the first 140, but I would like to include the name attributed to the quote at the end. Each quote is setup like this:
"I just said something famous." - Me
If the UILabel.text length is over 140 I would like to get the length, and subtract 140 from it, so I know how many characters must be removed. I have this part all setup in my code already. What I'm not for sure how to do is this:
If the quote has 200 characters, find " -
Then, remove the 63 characters immediately in front of " -
Replace those 63 characters with ...
This way a quote that looks like what I put above, if too long, would end up looking like:
"I just said someth..." - Me
I realize that there will be many occasions that it cuts a word off right in the middle, but I am willing to live with that. Any suggestions for removing a certain number of characters before the " - in the quote?
"I just said something famous." - Me
If the UILabel.text length is over 140 I would like to get the length, and subtract 140 from it, so I know how many characters must be removed. I have this part all setup in my code already. What I'm not for sure how to do is this:
If the quote has 200 characters, find " -
Then, remove the 63 characters immediately in front of " -
Replace those 63 characters with ...
This way a quote that looks like what I put above, if too long, would end up looking like:
"I just said someth..." - Me
I realize that there will be many occasions that it cuts a word off right in the middle, but I am willing to live with that. Any suggestions for removing a certain number of characters before the " - in the quote?