|
Posted by bgeneto on 06/20/06 19:25
StevePBurgess@gmail.com wrote:
> With a string of authors such as:
>
> Carson, David, Milne, Rebecca, Pakes, Francis J., Shalev, Karen,
> Shawyer, Andrea
>
> I would like to write a function to change every other comma into a
> semi colon (thereby defining where one name ends and the next begins).
>
> I could do it by writing a complex (and slow) procedure - but is there
> a quick way of doing it using regular expressions, for example?
>
> Many thanks.
Why not just use str_replace() intrinsic function?
$str = "Carson, David, Milne, Rebecca, Pakes, Francis J., Shalev,
Karen, Shawyer, Andrea";
$str = str_replace(",", ";", $str);
echo $str;
Bernhard Enders.
Navigation:
[Reply to this message]
|