Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33578 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48395 invoked by uid 1010); 2 Dec 2007 21:09:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 48380 invoked from network); 2 Dec 2007 21:09:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Dec 2007 21:09:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=felipensp@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=felipensp@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.132.240 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: felipensp@gmail.com X-Host-Fingerprint: 209.85.132.240 an-out-0708.google.com Received: from [209.85.132.240] ([209.85.132.240:24662] helo=an-out-0708.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/01-40848-E1F13574 for ; Sun, 02 Dec 2007 16:09:52 -0500 Received: by an-out-0708.google.com with SMTP id c18so612482anc for ; Sun, 02 Dec 2007 13:09:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; bh=RxImXneeT05ie4TunJxig9reOD22L5JkFsbBG+32bk4=; b=GYhETaOIey5jJW5436HL4vVq10PWpT3cloz327OkFPuW0x9YEaPwD0kSVRR2zKhW90M8TQI962Cr7y5PA/BdfoBEWDQuJeTJ2ESZ/1LVS4rnkjeTGnKdt892jZtaFstc37MA+4Kxi03LJa8yMc4lbv0RLCe4lfoeboc+yvnwlA0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:subject:from:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=yGMJz7GMR2iKDbIxgF9gym6ygelm0ibP3E7SzDrTX3cFzrFPrVwGJHSURIVftkj1345fEbiz+TD/LOmhDAH6rNTGvRUuxsUWwlYFFw6tyXeO/PwhEQzveBWxeS8Fv51VBlvdpKs5oPWxERBDukjkBhKZVtXWOcj4FUaIf1C6jSo= Received: by 10.100.214.15 with SMTP id m15mr18572939ang.1196629785781; Sun, 02 Dec 2007 13:09:45 -0800 (PST) Received: from ?189.24.16.171? ( [189.24.16.171]) by mx.google.com with ESMTPS id p27sm10921952ele.2007.12.02.13.09.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 02 Dec 2007 13:09:44 -0800 (PST) To: internals@lists.php.net Content-Type: text/plain Date: Sun, 02 Dec 2007 19:07:54 -0200 Message-ID: <1196629674.5919.22.camel@pena> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Subject: Proposal: str_truncate() From: felipensp@gmail.com (Felipe Pena) Hi. I guess interesting have in PHP one function for truncate string *without break it*, more specifically alphanumeric chars. PS: wordwrap() works different, see the phpt What you think about it? Patch: http://ecl.zoone.com.br/etc/patches/str_truncate.patch --TEST-- str_truncate --FILE-- --EXPECT-- string(27) "Lorem Ipsum is simply dummy" string(22) "Lorem Ipsum is simply " string(0) "" string(3) "foo" Regards. -- Felipe N. S. Pena