in reply to Formatting paragraph
foreach ($text) { s/&/&/g; s/</</g; s/>/>/g; s/\n/<br>/g; }
It's not perfect. For example, it won't stop the browser from collapsing multiple spaces into one. For that, you'd have to use something like the following:
foreach ($text) { s/&/&/g; s/</</g; s/>/>/g; $_ = "<pre>$_</pre>"; }
You have to restrict yourself to monospace fonts (like Courier New) for <pre> to work properly (but <pre> text should default to a monospace font).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Formatting paragraph
by pKai (Priest) on Feb 02, 2006 at 17:03 UTC | |
|
Re^2: Formatting paragraph
by blazar (Canon) on Feb 02, 2006 at 12:15 UTC | |
by clinton (Priest) on Feb 02, 2006 at 12:54 UTC | |
by ptum (Priest) on Feb 02, 2006 at 15:32 UTC |