comma delimited to single column

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rfigley
Forum Commoner
Posts: 70
Joined: Sun Apr 21, 2002 7:10 pm

comma delimited to single column

Post by rfigley »

I've got a file of email addresses that was exported from and AOL address book. all the email addresses are separted by a comma and a space. I want to convert it to a single column (each email address seperated by carriage return. What is the easiest way to do this?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

preg_replace

or just use some editor hehe.. that will put a->B
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

heck, [php_man]str_replace[/php_man]() can easily do this..
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Yep.

[php_man]explode[/php_man](), [php_man]str_replace[/php_man](), and [php_man]foreach[/php_man]() to be exact. :wink:
rfigley
Forum Commoner
Posts: 70
Joined: Sun Apr 21, 2002 7:10 pm

Post by rfigley »

OK actually. This conversion is for a text file to be imported into an bulkd emailer program. I have the text file (comma and space delimited) that I want to replace the comma space with a carriage return. It not for a php application. I gues you'd say I wnat to convert it from ", " delimited to "Carriage return" or "next line" delimited without doing it manually. Like a search and replace. The problem is doing a search and replace using ASCII code.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

our answers cover those.
Post Reply