Removing quotes from an array, string or txt file see code
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Removing quotes from an array, string or txt file see code

From: Techie Guy <out@thepub.com>
Date: Sun Oct 30 2005 - 12:34:43 CET

I'm trying to process a tab delimited file where each line in the file
has around 12 tab delimited elements. My problem is the elements are
surrounded by "quotes" and I need the script to remove the quotes
after loading the file to the $addresses variable.
The quotes need to be removed somewhere within the code below or by
processing the file before loading.

//read in the name and address lines from the txt file
//each line becomes an element in the array
$addresses= file("download.txt");

//count the number of address lines in the array
$number_of_addresses = count($addresses);
if ($number_of_addresses == 0)
{
echo "No addresses to process";
}

echo "<table>";

for($i=1; $i<$number_of_addresses; $i++)
{
//split each line or row
$line = explode("\t",$addresses[$i]);

TIA

More info if required
Received on Mon Nov 21 02:52:57 2005