[pmwiki-devel] trim() snag...

J. Meijer commentgg at hotmail.com
Thu May 10 12:40:04 CDT 2007



> ---------- Original message ----------
> From: The Editor <editor at fast.st>
> To: PmWiki Devel <pmwiki-devel at pmichaud.com>
> Hit a snag trying to improve the routine I used to manage CSV's
> I use this routine to strip the extra spaces out of a CSV list like:
> Bob  ,  Joe, Dave  , Ed
>         $i = explode(",", $value);
>         foreach ($i as $ii) {
>                 $out[] = trim($ii);
>                 }
>         $value = implode(",", $out);
> Can anyone see what I'm doing wrong? It seems to be having no effect
> on the spaces...
> Cheers,
> Dan

Works fine here but why not:

  $value=preg_replace('/ *, */',',',$value);

/jm


_________________________________________________________________
Create the ultimate e-mail address book. Import your contacts to Windows Live Hotmail.
www.windowslive-hotmail.com/learnmore/managemail2.html?locale=en-us&ocid=TXT_TAGLM_HMWL_reten_impcont_0507


More information about the pmwiki-devel mailing list