Jump to content


Photo

String length abbreviator


  • Please log in to reply
1 reply to this topic

#1 mort

mort
  • Members
  • PipPipPip
  • Advanced Member
  • 82 posts

Posted 22 September 2006 - 04:16 PM

Hey

You know when you get extra long URL's and some forums seem to abbreviate it using a few ...'s once it hits a certain length. Anyone point me in the right direction, or have a function to do this?

Want to use it for a) splitting up long strings, and b) for going through a string to look for stupidly long sections in the string not seperated by a space (which can destory tables and css positioning real good.

cheers :)

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 22 September 2006 - 04:28 PM

$address="http://www.thisisave...oooongurl.com";
echo '<a href="'.$address.'">'.substr($address, 0, 15).'...</a>';

u will need to add somthign to check that it is over 15 chars using strlen to return the value but there's the basics

Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users