You are here: Re: PHP Tokenize a String by its length « PHP Programming Language « IT news, forums, messages
Re: PHP Tokenize a String by its length

Posted by Geoff Berrow on 12/31/05 13:10

Message-ID: <HWstf.630$i%4.305@trndny08> from Lüpher Cypher contained
the following:

>Shorter :)
>
>function trancate($string,$length) {
> $string = substr(trim($string),0,$length);
> $string = substr($string,0,strrpos(trim($string)," "));
> return "$string...";
>}

You don't need the last trim()

$string = substr($string,0,strrpos($string," "));

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация