...

View Full Version : Stipping off Xtra carrige returns.



fritz Jung
07-24-2002, 08:57 PM
Greets,

I have a message system working... and can't figure out how to automatically trim off the extra carrige returns folks typically generate....

I am only interested in stripping off ALL carrige returns BEYOND the last LETTER that they type.

Help?

Fritz

Astro-Boy
07-25-2002, 12:56 AM
This should do the trick:


$txt = preg_replace('/\s*$/s', '', $txt);

- Mark

firepages
07-25-2002, 02:40 AM
or avoiding regex where possible....

$str=trim($str);

loot at ltrim(); and rtrim(); as well but trim strips whitepace and newlines etc from the beginning and end of a string.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum