'Intelligently' truncate string?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

 

I'm working on a page where I'm attempting to display article titles in a
relatively narrow area. To save from ugly wrap-arounds in the links, I've
decided to truncate the article title string at 20 chars. This works well
except where the truncate occasionally falls in the middle of a HTML entity
reference (eg   or © etc).

 

I'm wondering if anyone else on the list has worked out a way of
intelligently truncating a string to take these kinds of occurrences into
account? I don't mind, in these situations if the truncation takes place
before or after the entity, since when displayed it will only equate to one
character more or less.

 

Anyone else jumped off this bridge before?

 

Much warmth,

 

Murray


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux