Re: eliminar saltos de linea
| From: | Roberto Cesar Najera | Date: | Thu, 05 May 2005 20:06:42 +0000 |
| Subject: | Re: eliminar saltos de linea | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-54609@lists.php.net to get a copy of this message | ||
quiza te sirva esto lo saque del manual de php
You may need to keep in mind the different newline characters
(carriage return - CR, and linefeed - LF) employed by different OS's.
Windows uses CRLF (\r\n), Macintosh uses CR (\r), and *nix systems
generally use LF (\n). nl2br() seems to ONLY replace the \n
character. If you're dealing with text that has been created on a Win
or Mac box (such as input in an HTML textarea), you may have \r or
\r\n termination on the lines. To replace these with the \n standard,
you can use:
$text= preg_replace("/\r\n|\r/", "\n", $text);
- OR -
$text= str_replace('\r\n', '\n', $text);
$text= str_replace('\r', '\n', $text);
(this solution may be faster than the regex)
Saludos!
----- Original Message -----
From: "Gerardo Aquino" <mogurbon2000@yahoo.com.mx>
To: <>
Sent: Thursday, May 05, 2005 12:52 PM
Subject: [PHP-ES] eliminar saltos de linea
> disculpen, alguien sabe como eliminar saltos de linea
> de un texto?
>
> estoy utilizando esto pero no funciona
> preg_replace('/\n+/', ' ', $row->content)
> gracias
>
> _________________________________________________________
> Do You Yahoo!?
> La mejor conexión a internet y 25MB extra a tu correo por $100 al mes.
http://net.yahoo.com.mx
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php