Remove enter char from string and CSV files issues.
Posted: Mon Jun 07, 2010 9:54 am
Hi guys,
I got above the following string:
"EN ABRIL SE INCREMENTAN LOS PRECIOS DE VENTA POR EL AUMENTO EN LOS INSUMOS DE IMORTACION.
SE ESPERA QUE DISMINUYAN PARA INCREMENTAR LA DEMANDA."
this String it's going to be saved into a CSV file and every enter chars inserts the next sentence line in other line... I would like to have all together.
I have already replace the strings the \r ,\t and \n characters and it's still doesn't work. Is there any other speacial character for enter? As far as I know it was \r\n.
I also had troubles with the comas ',' because the columns are separeted with ',' and the remarks contain comas as well. I have reaplace the comas with semicolon ';' in order to solve this problem but it looks odd. Do you know another solution for this?
Thank you in advance,
cheers.
I got above the following string:
"EN ABRIL SE INCREMENTAN LOS PRECIOS DE VENTA POR EL AUMENTO EN LOS INSUMOS DE IMORTACION.
SE ESPERA QUE DISMINUYAN PARA INCREMENTAR LA DEMANDA."
this String it's going to be saved into a CSV file and every enter chars inserts the next sentence line in other line... I would like to have all together.
I have already replace the strings the \r ,\t and \n characters and it's still doesn't work. Is there any other speacial character for enter? As far as I know it was \r\n.
Code: Select all
$observacion = str_replace('\n', '', mysql_result($result, 0));
$observacion = str_replace('\r', '', $observacion);
$observacion = str_replace('\t', '', $observacion);
$observacion = str_replace(',', ';', $observacion);
$observacion = str_replace('\r\n', '', $observacion); Thank you in advance,
cheers.