Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Sydney, NSW, Australia
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This should do the trick:

    Code:
    $txt = preg_replace('/\s*$/s', '', $txt);
    - Mark

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •