To convert \n's to <br />\n's on any string, use nl2br(). To trim excess white space (\n, \r, [space] \t, etc) from both the beginning and end of a string, use trim().
Eg: <? $str = "this is a string with an\nenter in the middle, and two at the end\n\n"; $str = trim($str); $str = nl2br($str); echo $str; ?> This should echo: --- this is a string with an<br /> enter in the middle --- What do you actually want to do, and what's the problem? Justin on 08/12/02 5:28 PM, Dade Register ([EMAIL PROTECTED]) wrote: > Hey... I have a question about trim. I don't know if > trim() is the right funtion to use, but here is my > problem. > > I am recieving a textarea input from a form and > writing it to a data file. I need to change any line > breaks or (enter) if you will into a <br> or something > else. When it's in my text file, it screws it up. > Please, someone give me an idea of how to oversome > this. I can't seem to make trim() work at all. It does > remove a \n if you type that in, but won't actually > remove an (enter). Thanx for your help in advance. > > -Dade > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com Justin French -------------------- http://Indent.com.au Web Development & Graphic Design -------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php