substr based on strlen
Posted: Fri Jul 11, 2003 4:59 pm
I'm working on an article system and I'm not really sure how to go about one part. I need to have a string truncated based on how long it is.
For example:
If the string is over 200 characters, cut to 100.
If the string is over 600 characters, cut to 300.
If the string is over 1200 characters, cut to 600.
So in usage, the longer the article the more text is shown on a preview before it gets truncated. Any suggestions?
For example:
If the string is over 200 characters, cut to 100.
If the string is over 600 characters, cut to 300.
If the string is over 1200 characters, cut to 600.
So in usage, the longer the article the more text is shown on a preview before it gets truncated. Any suggestions?