Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-24-2002, 08:57 PM   PM User | #1
fritz Jung
New to the CF scene

 
Join Date: Jul 2002
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
fritz Jung is an unknown quantity at this point
Stipping off Xtra carrige returns.

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
__________________
Fritz Jung
co-founder
the Witches' Voice
www.witchvox.com
fritz Jung is offline   Reply With Quote
Old 07-25-2002, 12:56 AM   PM User | #2
Astro-Boy
New Coder

 
Join Date: Jun 2002
Location: Sydney, NSW, Australia
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Astro-Boy is an unknown quantity at this point
This should do the trick:

Code:
$txt = preg_replace('/\s*$/s', '', $txt);
- Mark
__________________
[ AstroBoy Online | Experiments in Stuff | Google, use it! ]
Astro-Boy is offline   Reply With Quote
Old 07-25-2002, 02:40 AM   PM User | #3
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,904
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
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.
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:12 PM.


Advertisement
Log in to turn off these ads.