This is a discussion on "cutting strings" within the PHP Forum section. This forum, and the thread "cutting strings are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
cutting strings
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
cutting strings
I would like to have a string be cut off if it is over a certain amount of characters and add ".." to the end of the string.
I think what I need is similiar to wordwrap but instead of starting a new line it just cuts the rest off. sorry if that isn't clear enough. cheers
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|
|
#2
|
||||
|
||||
|
Re: cutting strings
sorry!
got it substr()
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#3
|
||||
|
||||
|
Re: cutting strings
Help needed again....
is there anyway to do this without breaking html tags? and close any if they are left open? google was not my friend today
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#4
|
|||
|
|||
|
Re: cutting strings
Alex ... Google wasn't being your friend because there is no easy way
I can across a need to truncate a piece of HTML that I had gathered as a result of a search, and be able to display it robustly. Similar to your requirement, I think? I took the approach of replacing all tags with " ... " and then using a regular expression rather than substr to ensure that the remaining snippet was a few characters shorter than my maximum if necessary, but always broken at a white space. See http://www.wellho.net/net/search.php4?search=friend for an example of what you can achieve through this approach. |
|
#5
|
|||
|
|||
|
Re: cutting strings
not sure what exactly your trying to do, but play around with this:
|
|
#6
|
||||
|
||||
|
Re: cutting strings
I think I might just strip all tags :/
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
![]() |
| Tags |
| cut, strings |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Flash is cutting off bits of my text...any ideas? | Darkflame | Flash & Multimedia Forum | 2 | Mar 19th, 2007 14:16 |
| Scrollpane Cutting Off Content | tox0tes | Flash & Multimedia Forum | 4 | Jan 26th, 2007 19:50 |
| Javascript Strings Help | Sabin_33 | JavaScript Forum | 2 | Dec 21st, 2006 09:54 |
| Confused with strings... | ktsirig | Other Programming Languages | 1 | Jan 11th, 2006 18:02 |
| Quotes in strings | jakyra | Classic ASP | 5 | Sep 9th, 2003 15:10 |