note 72562 added to function.trim

From: Date: Wed, 24 Jan 2007 16:04:11 +0000
Subject: note 72562 added to function.trim
Groups: php.notes 
Request: Send a blank email to php-notes+get-122141@lists.php.net to get a copy of this message
I use this to remove leading, trailing and "more than one" space in between words. $pat[0] = "/^\s+/"; $pat[1] = "/\s{2,}/"; $pat[2] = "/\s+\$/"; $rep[0] = ""; $rep[1] = " "; $rep[2] = ""; $str = " Words with lots of spaces "; $str = preg_replace($pat,$rep,$str); // Output "Words with lots of spaces" ---- Server IP: 69.147.83.197 Probable Submitter: 89.150.147.144 ---- Manual Page -- http://www.php.net/manual/en/function.trim.php Edit -- https://master.php.net/note/edit/72562 Del: integrated -- https://master.php.net/note/delete/72562/integrated Del: useless -- https://master.php.net/note/delete/72562/useless Del: bad code -- https://master.php.net/note/delete/72562/bad+code Del: spam -- https://master.php.net/note/delete/72562/spam Del: non-english -- https://master.php.net/note/delete/72562/non-english Del: in docs -- https://master.php.net/note/delete/72562/in+docs Del: other reasons-- https://master.php.net/note/delete/72562 Reject -- https://master.php.net/note/reject/72562 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122141) next »